SUB logbl (logfile$, m%, nx%, imag!(), vt!(), svt!(), bl!(), sbl!(), r!(), sr!()) '**************************************************************************** 'This subroutine writes the bl measurement log file. ' 'Inputs: ' logfile$, the name of the log file ' m%, index giving reference magnet 0 or magnet under test ' nx%, the number of x-positions ' imag!(1 to nx%), the measured currents ' vt!(1 to nx%), the integrated voltages ' svt!(1 to nx%), the standard deviation on the measured integrated voltage ' bl!(1 to nx%), the integrated field strengths ' sbl!(1 to nx%), the standard deviation on the integrated field strength ' r!(1 to nx%), ratio of test strength to reference strength ' sr!(1 to nx%), error estimate of r! ' 'Zachary Wolf '5/4/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Write which magnet the data is for PRINT #filenum%, IF m% = 0 THEN PRINT #filenum%, "BL Measurements For The Reference Magnet:" ELSE PRINT #filenum%, "BL Measurements For The Magnet Under Test:" END IF 'For the reference magnet IF m% = 0 THEN 'Write the header PRINT #filenum%, " X I VT sigVT BL sigBL " PRINT #filenum%, " (A) (VS) (VS) (TM) (TM) " PRINT #filenum%, "----- ------- -------- -------- -------- --------" 'Write the values FOR i% = 1 TO nx% PRINT #filenum%, USING "#####"; i%; PRINT #filenum%, USING " ###.###"; imag!(i%); PRINT #filenum%, USING " ##.#####"; vt(i%); PRINT #filenum%, USING " ##.#####"; svt!(i%); PRINT #filenum%, USING " ##.#####"; bl!(i%); PRINT #filenum%, USING " ##.#####"; sbl!(i%) NEXT i% 'End reference magnet print END IF 'For the magnet under test IF m% <> 0 THEN 'Write the header PRINT #filenum%, " X I VT sigVT BL sigBL BL/BLref sig " PRINT #filenum%, " (A) (VS) (VS) (TM) (TM) BL/BLref" PRINT #filenum%, "----- ------- -------- -------- -------- -------- -------- --------" 'Write the values FOR i% = 1 TO nx% PRINT #filenum%, USING "#####"; i%; PRINT #filenum%, USING " ###.###"; imag!(i%); PRINT #filenum%, USING " ##.#####"; vt(i%); PRINT #filenum%, USING " ##.#####"; svt!(i%); PRINT #filenum%, USING " ##.#####"; bl!(i%); PRINT #filenum%, USING " ##.#####"; sbl!(i%); PRINT #filenum%, USING " #.######"; r!(i%); PRINT #filenum%, USING " #.######"; sr!(i%) NEXT i% 'End magnet under test print END IF 'Close the log file CLOSE filenum% END SUB SUB logheader (logfile$, mn$, op$, ts$, dv$, rn$, cm$, n1%, i1!(), n2%, i2!()) '**************************************************************************** 'This subroutine writes the header of the log file. ' 'Input: ' logfile$, name, including the path, of the log file ' mn$, magnet name ' op$, operator name ' ts$, the name of the test stand which is being used ' dv$, the name of the measurement device ' rn$, the run number ' cm$, a comment about the test ' n1%, the number of standardization ramps ' i1!(1 to n1%), the standardization currents ' n2%, the number of currents ibdl is measured at ' i2!(1 to n2%), the test currents ' 'Zachary Wolf '4/16/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print a general header PRINT #filenum%, "B-Factory Magnetic Measurements" PRINT #filenum%, "Date: "; DATE$ PRINT #filenum%, "Time: "; TIME$ PRINT #filenum%, 'Print the magnet test parameters to the log file PRINT #filenum%, "Magnet Name: "; mn$ PRINT #filenum%, "Test Operator: "; op$ PRINT #filenum%, "Test Stand: "; ts$ PRINT #filenum%, "Apparatus: "; dv$ PRINT #filenum%, "Run Number: "; rn$ PRINT #filenum%, "Comment: "; cm$ 'Write the standardization currents to the log file PRINT #filenum%, PRINT #filenum%, "Magnet Standardization Currents (Amps): " FOR i% = 1 TO n1% STEP 6 FOR j% = 0 TO 5 IF i% + j% > n1% THEN EXIT FOR PRINT #filenum%, USING " #####.#"; i1!(i% + j%); NEXT j% PRINT #filenum%, NEXT i% 'Write the test currents to the log file PRINT #filenum%, PRINT #filenum%, "Measurement Currents (Amps): " FOR i% = 1 TO n2% STEP 6 FOR j% = 0 TO 5 IF i% + j% > n2% THEN EXIT FOR PRINT #filenum%, USING " #####.#"; i2!(i% + j%); NEXT j% PRINT #filenum%, NEXT i% 'Close the log file CLOSE filenum% END SUB SUB logopen (logfile$) '**************************************************************************** 'This subroutine creates the log file. The name of the file is passed 'to the subroutine. It then closes the log file. All other routines append 'information to the file. ' 'Inputs: logfile$, path and name of the log file ' 'Zachary Wolf '4/14/94 '**************************************************************************** 'Create the log file filenum% = FREEFILE OPEN logfile$ FOR OUTPUT AS filenum% 'Close the log file CLOSE filenum% END SUB SUB logplot (logfile$, magname$, run$, nx%, ni%, imag!(), r!(), sr!()) '**************************************************************************** 'This subroutine writes the BL measurement data file for plotting. ' 'Inputs: ' logfile$, the name of the log file ' magname$, magnet name ' run$, run number ' nx%, the number of x-positions ' ni%, the number of currents ' imag!(1 to ni%), the nominal magnet currents ' r!(1 to nx%, 1 to ni%), bl ratios relative to the reference ' sr!(1 to nx%, 1 to ni%), errors on r! ' 'Zachary Wolf '5/12/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 nominal currents FOR i% = 1 TO ni% PRINT #filenum%, "/sa l 'I = " + STR$(imag!(i%)) + " A' " + STR$(2 * i%) NEXT i% 'Write the values FOR i% = 1 TO nx% PRINT #filenum%, USING "##"; i%; FOR j% = 1 TO ni% PRINT #filenum%, USING " #.#####"; r!(i%, j%); PRINT #filenum%, USING " #.#####"; sr!(i%, j%); NEXT j% PRINT #filenum%, NEXT i% 'End of curve PRINT #filenum%, "//nc" 'Close the log file CLOSE filenum% END SUB SUB logstand (logfile$, m%, ni%, imag!(), bl!(), sbl!()) '**************************************************************************** 'This subroutine writes the bl measurement taken during standardization 'to the log file. ' 'Inputs: ' logfile$, the name of the log file ' m%, index giving reference magnet 0 or magnet under test 1 or 2 ' ni%, the number of currents ' imag!(1 to ni%), the measured currents ' bl!(1 to ni%), the integrated field strengths ' sbl!(1 to ni%), the standard deviation on the integrated field strength ' 'Zachary Wolf '5/14/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Write which magnet the data is for PRINT #filenum%, IF m% = 0 THEN PRINT #filenum%, "BL Measurements For The Reference Magnet Taken During Standardization:" ELSE PRINT #filenum%, "BL Measurements For The Magnet Under Test Taken During Standardization:" END IF 'Write the header PRINT #filenum%, " I BL sigBL " PRINT #filenum%, " (A) (TM) (TM) " PRINT #filenum%, " ------- -------- --------" 'Write the values FOR i% = 1 TO ni% PRINT #filenum%, USING " ####.##"; imag!(i%); PRINT #filenum%, USING " ##.#####"; bl!(i%); PRINT #filenum%, USING " ##.#####"; sbl!(i%) NEXT i% 'Close the log file CLOSE filenum% END SUB SUB logvt (logfile$, X%, m%, i1!, i2!, nave%, vtp!(), vtn!()) '**************************************************************************** 'This subroutine records the integrated voltage from the rotating coil 'to the log file. ' 'Input: ' logfile$, the name of the log file ' x%, index giving the x-position ' m%, index giving reference magnet 0 or magnet under test 1 ' i1!, the current before the measurement ' i2!, the current after the measurement ' nave%, the number of measurements used in the average ' vtp!(1 to nave%), the positive voltage integrals ' vtn!(1 to nave%), the negative voltage integrals ' 'Zachary Wolf '5/12/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Reference or test magnet IF m% = 0 THEN mag$ = "Reference Magnet" IF m% <> 0 THEN mag$ = "Magnet Under Test" 'Write the integrated voltage information to the log file PRINT #filenum%, PRINT #filenum%, "X-Position "; X% PRINT #filenum%, mag$, "Ibefore = "; i1!, "Iafter = "; i2! 'Write the integrated voltages FOR i% = 1 TO nave% STEP 4 PRINT #filenum%, "VT+- = "; FOR j% = 0 TO 3 IF i% + j% > nave% THEN EXIT FOR PRINT #filenum%, USING " ##.#####"; vtp!(i% + j%); PRINT #filenum%, USING " ##.#####"; vtn!(i% + j%); NEXT j% PRINT #filenum%, NEXT i% 'Close the log file CLOSE filenum% END SUB