DECLARE SUB mtoolsethallrng () DECLARE SUB zhcheckpar (ok$) DECLARE SUB zhdatbl (logfile$, bl!) DECLARE SUB zhdatbvsz (logfile$, i%, z!, imag!, bhall!) DECLARE SUB zhlogbl (logfile$, bl!) DECLARE SUB zhpltbvsz (logfile$, i%, z!, bhall!) DECLARE SUB mtoolgetbh (bhall!) DECLARE SUB mtoolmovez (z!) DECLARE SUB mtooltrapint (ns%, x!(), y!(), iydx!) DECLARE SUB ls450setrange (r%) DECLARE SUB gp3setrange (r%) DECLARE SUB imaggeti (imag!) '**************************************************************************** 'Module ZMAPH 'This module performs Hall probe measurements along a magnet. ' 'Zachary Wolf '12/26/95 '**************************************************************************** 'Common area for shared parameters COMMON SHARED /zmaph/ logfileP$, datfileP$, pltfileP$, nzposP%, zposP!() SUB zhbvsz '**************************************************************************** 'This subroutine controls Hall probe measurements of B along a magnet. 'The integrated field strength is calculated. ' 'Zachary Wolf '12/26/95 '**************************************************************************** 'Make sure required parameters have been defined CALL zhcheckpar(ok$) IF ok$ <> "y" THEN PRINT "ZHMAP: parameter problem" EXIT SUB END IF 'Set the Hall probe range CALL mtoolsethallrng 'Save the field measurements to calculate BL DIM bmap!(1 TO nzposP%) 'Prepare the screen CLS PRINT PRINT " Z Field Map" PRINT PRINT " Z Imag Bhall " PRINT " # (m) (A) (T) " PRINT "----- --------- --------- ---------" currpos% = 6 'Loop over z positions FOR i% = 1 TO nzposP% 'Allow run to end if there is a problem IF INKEY$ = CHR$(27) THEN EXIT SUB 'Move to the the z position CALL mtoolmovez(zposP!(i%)) 'Measure the current CALL imaggeti(imag!) 'Measure the field strength CALL mtoolgetbh(bhall!) 'Save the value for the BL calculation bmap!(i%) = bhall! 'Write the results to the screen VIEW PRINT 7 TO 20 currpos% = currpos% + 1 IF currpos% > 20 THEN currpos% = 20 LOCATE currpos% PRINT USING "#####"; i%; PRINT USING " ####.####"; zposP!(i%) / 100!; PRINT USING " #####.###"; imag!; PRINT USING " ##.######"; bhall! 'Write the measured values to the dat file CALL zhdatbvsz(datfileP$, i%, zposP!(i%), imag!, bhall!) 'Write the measurements to the plot file CALL zhpltbvsz(pltfileP$, i%, zposP!(i%), bhall!) 'End loop over z positions NEXT i% 'Integrate the Bmap field strengths CALL mtooltrapint(nzposP%, zposP!(), bmap!(), bl!) 'Convert BL from Tcm to Tm bl! = bl! / 100! 'Log the result CALL zhlogbl(logfileP$, bl!) 'Write the field integral to the data file CALL zhdatbl(datfileP$, bl!) 'Message VIEW PRINT 21 TO 24 CLS PRINT PRINT "Done." 'Move back to Z = 0 PRINT "Moving back to Z = 0..." CALL mtoolmovez(0!) 'Reset the screen viewing area VIEW PRINT LOCATE 24 END SUB SUB zhcheckpar (ok$) '**************************************************************************** 'This subroutine checks that all required parameters have been assigned 'values. ' 'Output: ' ok$, "y" if parameter assignments are ok, "n" otherwise ' 'Zachary Wolf '9/18/95 '**************************************************************************** 'Default value ok$ = "n" 'logfileP$, datfileP$, pltfileP$ IF logfileP$ = "" OR datfileP$ = "" OR pltfileP$ = "" THEN PRINT "ZMAPH: required file not defined" EXIT SUB END IF 'If we made it this far, all parameters have values ok$ = "y" END SUB SUB zhdatbl (logfile$, bl!) '**************************************************************************** 'This subroutine writes a summary to the log file. ' 'Inputs: ' logfile$, the name of the log file ' bl!, the measured integrated field strength ' 'Zachary Wolf '6/22/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Write a header PRINT #filenum%, PRINT #filenum%, "Integrated Field Strength:" 'Write the values PRINT #filenum%, "The integrated field strength BL = "; bl!; " Tm" 'Close the log file CLOSE filenum% END SUB SUB zhdatbvsz (logfile$, i%, z!, imag!, bhall!) '**************************************************************************** 'This subroutine writes a summary to the data file. ' 'Inputs: ' logfile$, the name of the log file ' i%, index for the z position ' z!, the z position ' imag!, the measured magnet current ' bhall!, the measured magnetic field strength from the Hall probe ' 'Zachary Wolf '12/23/95 '**************************************************************************** 'Keep track of the number of times called STATIC ncall% ncall% = ncall% + 1 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Start a new page for a new series of measurements IF ncall% > 1 AND i% = 1 THEN PRINT #filenum%, CHR$(12) END IF 'Write a header on the first measurement IF i% = 1 THEN PRINT #filenum%, PRINT #filenum%, " Hall Probe Measurements" 'Write the header PRINT #filenum%, " Zpos I Bhall " ' PRINT #filenum%, " # (m) (A) (T) " PRINT #filenum%, " # (in) (A) (T) " PRINT #filenum%, " ----- --------- --------- ---------" END IF 'Write the values PRINT #filenum%, USING " #####"; i%; PRINT #filenum%, USING " ###.#####"; z! / 2.54; 'PRINT #filenum%, USING " ###.#####"; z! / 100; PRINT #filenum%, USING " #####.###"; imag!; PRINT #filenum%, USING " ##.######"; bhall! 'Close the log file CLOSE filenum% END SUB SUB zhlogbl (logfile$, bl!) '**************************************************************************** 'This subroutine logs the calculated integrated field strength. ' 'Input: ' logfile$, the name of the log file ' bl!, the integrated field strength (Tm) ' 'Zachary Wolf '12/23/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the results PRINT #filenum%, TIME$; " Integrated Field Strength BL = "; bl!; " Tm" 'Close the log file CLOSE filenum% END SUB SUB zhpltbvsz (logfile$, i%, z!, bhall!) '**************************************************************************** 'This subroutine writes a field measurement to the plot file. ' 'Inputs: ' logfile$, name of data file ' i%, index for the z position ' z!, z position the measurement was taken at (cm) ' bhall!, hall probe measurement (T) ' 'Zachary Wolf '12/11/95 '**************************************************************************** 'Keep track of the number of times called STATIC ncall% ncall% = ncall% + 1 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Insert an empty line before a new series of measurements IF ncall% > 1 AND i% = 1 THEN PRINT #filenum%, END IF 'Write a header on the first measurement IF i% = 1 THEN PRINT #filenum%, ";z(m), Bhall(T)" END IF 'Write the values PRINT #filenum%, USING "#####.####"; z! / 2.54; 'PRINT #filenum%, USING "#####.####"; z! / 100!; PRINT #filenum%, USING " ###.######"; bhall! 'Close the log file CLOSE filenum% END SUB SUB zhsetpar (logfile$, datfile$, pltfile$, nzpos%, zpos!()) '**************************************************************************** 'This subroutine sets the parameters for the XY mapping module. ' 'Input: ' logfile$, name of the log file ' datfile$, name of the data file ' pltfile$, name of the plot file ' nzpos%, number of z positions to make measurements at ' zpos!(1 to nzpos%), the z positions to make measurements at ' 'Zachary Wolf '12/11/95 '**************************************************************************** 'Save the parameters in a common block for future use logfileP$ = logfile$ datfileP$ = datfile$ pltfileP$ = pltfile$ nzposP% = nzpos% DIM zposP!(1 TO nzposP%) FOR i% = 1 TO nzposP% zposP!(i%) = zpos!(i%) NEXT i% END SUB