DECLARE SUB harplotmeasure (logfile$, magname$, run$, ni%, nx%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) DECLARE SUB blmeasbl (imag!, simag!, vt!, svt!, bl!, sbl!, tf!, stf!) DECLARE SUB logplot (logfile$, magname$, run$, ni%, nx%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) DECLARE SUB harlogmeasure (logfile$, ni%, nx%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) DECLARE SUB imagramp (inom!) '**************************************************************************** 'Module HAR ' 'Zachary Wolf '3/21/95 '**************************************************************************** 'Open the parameter file REM $INCLUDE: 'param.inc' SUB harlogmeasure (logfile$, ni%, nx%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) '**************************************************************************** 'This subroutine writes the bl measurement log file. ' 'Inputs: ' logfile$, the name of the log file ' ni%, the number of currents ' nx%, the number of x-positions ' imag!(1 to ni%, 1 to nx%), the measured currents ' vt!(1 to ni%, 1 to nx%), the integrated voltages ' svt!(1 to ni%, 1 to nx%), the standard deviation on the measured integrated voltage ' bl!(1 to ni%, 1 to nx%), the integrated field strengths ' sbl!(1 to ni%, 1 to nx%), the standard deviation on the integrated field strength ' tf!(1 to ni%, 1 to nx%), the magnet transfer function BL/I ' stf!(1 to ni%, 1 to nx%), the standard deviation on the transfer function ' 'Zachary Wolf '11/25/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Title PRINT #filenum%, PRINT #filenum%, " FIELD UNIFORMITY MEASUREMENTS" 'Write the header PRINT #filenum%, PRINT #filenum%, " I X VT sigVT BL sigBL " PRINT #filenum%, " (A) # (VS) (VS) (TM) (TM) " PRINT #filenum%, "------- --- --------+-------- --------+--------" 'Write the values FOR i% = 1 TO ni% FOR x% = 1 TO nx% PRINT #filenum%, USING "####.##"; imag!(i%, x%); PRINT #filenum%, USING " ###"; x%; PRINT #filenum%, USING " ##.#####"; vt!(i%, x%); PRINT #filenum%, USING " ##.#####"; svt!(i%, x%); PRINT #filenum%, USING " ##.#####"; bl!(i%, x%); PRINT #filenum%, USING " ##.#####"; sbl!(i%, x%) NEXT x% PRINT #filenum%, NEXT i% 'Close the log file CLOSE filenum% END SUB SUB harmeasure '**************************************************************************** 'This subroutine controls the measurement of the integrated field strength 'as a function of current and as a function of x-position for the 'A-Line dipoles. 'Constants come from param.inc. ' 'Zachary Wolf '11/25/94 '**************************************************************************** 'Message PRINT PRINT "Beginning the measurement cycle..." 'Simplify the notation ni% = nimagharP% nx% = nxpositionsP% 'Initialize data arrays DIM imag!(1 TO ni%, 1 TO nx%) 'measured magnet current DIM vt!(1 TO ni%, 1 TO nx%) 'integrated voltage DIM svt!(1 TO ni%, 1 TO nx%) 'standard deviation DIM bl!(1 TO ni%, 1 TO nx%) 'integrated field strength DIM sbl!(1 TO ni%, 1 TO nx%) 'standard deviation DIM tf!(1 TO ni%, 1 TO nx%) 'transfer function BL/I DIM stf!(1 TO ni%, 1 TO nx%) 'standard deviation 'Loop over currents FOR i% = 1 TO ni% 'Ramp to the desired current CALL imagramp(imagharP!(i%)) 'Loop over x-positions FOR x% = 1 TO nx% 'Message to move coils PRINT PRINT "Please move the coil to position "; x%; "." INPUT "Press ENTER when ready.", a$ 'Make a measurement CALL blmeasbl(imag!(i%, x%), simag!, vt!(i%, x%), svt!(i%, x%), bl!(i%, x%), sbl!(i%, x%), tf!(i%, x%), stf!(i%, x%)) 'End loop over x-positions NEXT x% 'End loop over currents NEXT i% 'Write the results to the log file and data file CALL harlogmeasure(logfileP$, ni%, nx%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) CALL harlogmeasure(datfileP$, ni%, nx%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) 'Write the results to the plotting file CALL harplotmeasure(pltfileP$, magnameP$, runP$, ni%, nx%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) END SUB SUB harplotmeasure (logfile$, magname$, run$, ni%, nx%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) '**************************************************************************** 'This subroutine writes the BL measurement plot file for plotting. ' 'Inputs: ' logfile$, the name of the log file ' magname$, magnet name ' run$, run number ' ni%, the number of currents ' nx%, the number of x-positions ' imag!(1 to ni%, 1 to nx%), the current the test magnet was measured at ' vt!(1 to ni%, 1 to nx%), the integrated voltage measurements ' svt!(1 to ni%, 1 to nx%), standard deviation on vt! ' bl!(1 to ni%, 1 to nx%), the integrated field strengths ' sbl!(1 to ni%, 1 to nx%), the error on bl! ' tf!(1 to ni%, 1 to nx%), the transfer function ' stf!(1 to ni%, 1 to nx%), the error on tf! ' 'Zachary Wolf '11/25/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Write the title for plotting PRINT #filenum%, "/et g '" + magname$ + ", Run " + run$ + "'" 'Write the title for each curve FOR i% = 1 TO ni% PRINT #filenum%, "/sa l 'I = "; PRINT #filenum%, USING "###"; imag!(i%, 1); PRINT #filenum%, " A' "; 2 * i% NEXT i% 'Write the values FOR x% = 1 TO nx% PRINT #filenum%, USING "###"; x%; FOR i% = 1 TO ni% PRINT #filenum%, USING " ###.####"; bl!(i%, x%); PRINT #filenum%, USING " ###.####"; sbl!(i%, x%); NEXT i% PRINT #filenum%, NEXT x% 'Close the log file CLOSE filenum% END SUB