DECLARE SUB movethzero () DECLARE SUB movethgohome () DECLARE SUB movezgohome () DECLARE SUB movezzero () DECLARE SUB movezabs (z!) DECLARE SUB movethabs (th!) DECLARE SUB pt2025setcoarse (b!) DECLARE SUB mappltzslice (pltslicedir$, slicenum%, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsen%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) DECLARE SUB mapplttslice (pltslicedir$, slicenum%, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsen%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) DECLARE SUB fileexist (file$, yn$) DECLARE SUB mapdatconfig (configdir$) DECLARE SUB fileplot (file$, epfile$) DECLARE SUB mappltslice (pltslicedir$, slicenum%, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsen%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) DECLARE SUB mappltztscan (logfile$, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsen%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) DECLARE SUB mapcheckpar (ok$) DECLARE SUB mapdatztscan (logfile$, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsen%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) DECLARE SUB mapgetzt (nzptsP%, zptsP!(), ntptsP%, tptsP!()) DECLARE SUB ibabgetiav (id%, imag!, simag!) DECLARE SUB tbabgett (id%, temp!) DECLARE SUB movegetth (th!) DECLARE SUB movegetz (z!) DECLARE SUB moveth (th!) DECLARE SUB movez (z!) DECLARE SUB sengetbav (id%, b!, sb!) DECLARE SUB sengetname (id%, name$) DECLARE SUB gp3getbav (id%, b!, sb!) DECLARE SUB pt2025getb (b!) '**************************************************************************** 'Module MAP ' 'This module contains routines for controlling the Babar solenoid map. ' 'Zachary Wolf '9/20/97 '**************************************************************************** 'Common block for module level parameters COMMON SHARED /map/ datfileP$, logfileP$, pltfileP$, slicedirP$, zminlimitP!, zmaxlimitP!, tminlimitP!, tmaxlimitP!, bnmrnomP!, nsenP% 'Semi-permanent parameters CONST maxnzptsP% = 100 'Maximum number of Z measurement positions CONST maxntptsP% = 100 'Maximum number of TH measurement positions SUB mapcheckpar (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/97 '**************************************************************************** 'Default value ok$ = "n" 'Datfile IF datfileP$ = "" THEN PRINT "MAP: Data file not defined" EXIT SUB END IF 'Logfile IF logfileP$ = "" THEN PRINT "MAP: Log file not defined" EXIT SUB END IF 'Pltfile IF pltfileP$ = "" THEN PRINT "MAP: Plot file not defined" EXIT SUB END IF 'Slicedir IF slicedirP$ = "" THEN PRINT "MAP: Slice directory not defined" EXIT SUB END IF 'Z scan limits IF ABS(zminlimitP!) > 5! OR ABS(zmaxlimitP!) > 5! THEN PRINT "MAP: improper Z scan parameters" EXIT SUB END IF 'TH scan limits IF ABS(tminlimitP!) > 370! OR ABS(tmaxlimitP!) > 370! THEN PRINT "MAP: improper TH scan parameters" EXIT SUB END IF 'Bnmr nominal IF bnmrnomP! <= 0 THEN PRINT "MAP: improper nominal NMR field value" EXIT SUB END IF '# of Sentron Hall probes IF nsenP% <= 0 THEN PRINT "MAP: improper # of Sentron Hall probes" EXIT SUB END IF 'If we made it this far, all parameters have values ok$ = "y" END SUB SUB mapdatconfig (configdir$) '**************************************************************************** 'This subroutine records the probe configuration used for the field map. ' 'Input: ' configdir$, directory to put the configuration data in ' 'Zachary Wolf '2/20/98 '**************************************************************************** 'Open the file for the configuration info filenum% = FREEFILE configfile$ = configdir$ + "\config.dat" OPEN configfile$ FOR OUTPUT AS filenum% 'Write the probe configuration information PRINT #filenum%, PRINT #filenum%, " SENSOR CONFIGURATION INFORMATION" PRINT #filenum%, PRINT #filenum%, " This file is a record of the positions of the sensors making up" PRINT #filenum%, "the measurement system." PRINT #filenum%, " The probe plate has four possible positions. Position 1 is at the" PRINT #filenum%, "smallest radius. The first probe is 13 cm from the axis." PRINT #filenum%, "Position 2 has the probe plate moved out 7.5 cm in radius relative to" PRINT #filenum%, "position 1. The first probe is 20.5 cm from the axis." PRINT #filenum%, "In position 3 the first probe is 65.5 cm from the axis." PRINT #filenum%, "In position 4 the first probe is 73.0 cm from the axis." PRINT #filenum%, "The user is asked to enter the probe plate position and it is recorded" PRINT #filenum%, "in the header of the data file." PRINT #filenum%, PRINT #filenum%, " The following is a list of all measurements made along with an explanation" PRINT #filenum%, "of the measurement. The list is organized according to column number in the" PRINT #filenum%, "data file." PRINT #filenum%, PRINT #filenum%, "Column 1, Z_mapper (m)" PRINT #filenum%, " Measured with an electronic linear scale. The accuracy is roughly 20 microns," PRINT #filenum%, " excluding thermal expansion effects." PRINT #filenum%, "Column 2, THETA_mapper (deg)" PRINT #filenum%, " Measured with a rotary encoder coupled through a 1:1 pulley to the drive" PRINT #filenum%, " shaft of the mapper arm." PRINT #filenum%, "Column 3, Imag_1 (A)" PRINT #filenum%, "Column 4, sigImag_1 (A)" PRINT #filenum%, " This is the current in the solenoid along with the rms variation of repeated" PRINT #filenum%, " measurements." PRINT #filenum%, "Column 5, Imag_2 (A)" PRINT #filenum%, "Column 6, sigImag_2 (A)" PRINT #filenum%, " This is the current through the solenoid plus the current through the dump" PRINT #filenum%, " resistor." PRINT #filenum%, "Column 7, Probe plate temperature 1 (deg C)" PRINT #filenum%, " Measurement made by a thermistor attached to the probe plate." PRINT #filenum%, " We checked that the magnetic field does not affect the reading." PRINT #filenum%, "Column 8, Probe plate temperature 2 (deg C)" PRINT #filenum%, " Redundant measurement of the probe plate temperature." PRINT #filenum%, "Column 9, B_NMR (T)" PRINT #filenum%, " The NMR is located at a radius of xx cm on the measurement arm." PRINT #filenum%, " It does not move with the probe plate." PRINT #filenum%, "Column 10, Group3 Probe #1 (T)" PRINT #filenum%, "Column 11, sigGroup3 Probe #1 (T)" PRINT #filenum%, " This probe measures Bz at position 1. It is located" PRINT #filenum%, " directly under the Sentron probe at postion 1. Because one of the sentron" PRINT #filenum%, " probes broke, this is the main Bz measurement at this location." PRINT #filenum%, "Column 12, Group3 Probe #2 (T)" PRINT #filenum%, "Column 13, sigGroup3 Probe #2 (T)" PRINT #filenum%, " This probe measures Bz at position 3. It is located" PRINT #filenum%, " directly under the Sentron probe at postion 3. It is a backup measurement." PRINT #filenum%, "Column 14, backup Br from Sentron probe #1 (T)" PRINT #filenum%, "Column 15, backup sigBr from Sentron probe #1 (T)" PRINT #filenum%, " This probe measures Br at position 1 on the probe plate." PRINT #filenum%, " It is at a radius of 0 cm relative to probe positon 1." PRINT #filenum%, " It is a Bz and Br probe. The Br element broke. We turned it" PRINT #filenum%, " on its side so the Bz element is measuring Br." PRINT #filenum%, " The rms variation of repeated readings is also given." PRINT #filenum%, "Column 16, Bz from Sentron probe #2 (T)" PRINT #filenum%, "Column 17, sigBz from Sentron probe #2 (T)" PRINT #filenum%, " This probe is at a radius of 15 cm relative to position 1." PRINT #filenum%, " It is a Bz and Br probe." PRINT #filenum%, " The rms variation of repeated readings is also given." PRINT #filenum%, "Column 18, Bz from Sentron probe #3 (T)" PRINT #filenum%, "Column 19, sigBz from Sentron probe #3 (T)" PRINT #filenum%, " This probe is at a radius of 30 cm relative to position 1." PRINT #filenum%, " It is a Bz and Br probe." PRINT #filenum%, " The rms variation of repeated readings is also given." PRINT #filenum%, "Column 20, Bz from Sentron probe #4 (T)" PRINT #filenum%, "Column 21, sigBz from Sentron probe #4 (T)" PRINT #filenum%, " This probe is at a radius of 45 cm relative to position 1." PRINT #filenum%, " The rms variation of repeated readings is also given." PRINT #filenum%, "Column 22, Bz from Sentron probe #5 (T)" PRINT #filenum%, "Column 23, sigBz from Sentron probe #5 (T)" PRINT #filenum%, " This probe is at a radius of 60 cm relative to position 1." PRINT #filenum%, " The rms variation of repeated readings is also given." PRINT #filenum%, "Column 24, Br from Sentron probe #1 (T)" PRINT #filenum%, "Column 25, sigBr from Sentron probe #1 (T)" PRINT #filenum%, " This probe is broken. The output should be around 9 V." PRINT #filenum%, " The rms variation of repeated readings is also given." PRINT #filenum%, "Column 26, Br from Sentron probe #2 (T)" PRINT #filenum%, "Column 27, sigBr from Sentron probe #2 (T)" PRINT #filenum%, " This probe is at a radius of 15 cm relative to position 1." PRINT #filenum%, " The rms variation of repeated readings is also given." PRINT #filenum%, "Column 28, Br from Sentron probe #3 (T)" PRINT #filenum%, "Column 29, sigBr from Sentron probe #3 (T)" PRINT #filenum%, " This probe is at a radius of 30 cm relative to position 1." PRINT #filenum%, " The rms variation of repeated readings is also given." PRINT #filenum%, "Column 30, Br from Sentron probe #4 (T)" PRINT #filenum%, "Column 31, sigBr from Sentron probe #4 (T)" PRINT #filenum%, " This probe is at a radius of 45 cm relative to position 1." PRINT #filenum%, " The rms variation of repeated readings is also given." PRINT #filenum%, "Column 32, Br from Sentron probe #5 (T)" PRINT #filenum%, "Column 33, sigBr from Sentron probe #5 (T)" PRINT #filenum%, " This probe is at a radius of 60 cm relative to position 1." PRINT #filenum%, " The rms variation of repeated readings is also given." PRINT #filenum%, "Column 34, Bphi from Sentron probe #6 (T)" PRINT #filenum%, "Column 35, sigBphi from Sentron probe #6 (T)" PRINT #filenum%, " This is an axial probe at a radius of 22.5 cm." PRINT #filenum%, " The rms variation of repeated readings is also given." PRINT #filenum%, "Column 36, Bphi from Sentron probe #7 (T)" PRINT #filenum%, "Column 37, sigBphi from Sentron probe #7 (T)" PRINT #filenum%, " This is an axial probe at a radius of 52.5 cm." PRINT #filenum%, " The rms variation of repeated readings is also given." PRINT #filenum%, "Column 38, Br from the Sentron loaner probe (T)" PRINT #filenum%, "Column 39, sigBr from the Sentron loaner probe (T)" PRINT #filenum%, " This is a transverse probe at a radius of 00.0 cm." PRINT #filenum%, " The rms variation of repeated readings is also given." PRINT #filenum%, "Column 40, Group 3 probe fixed in the magnet steel" PRINT #filenum%, "Column 41, sigGroup 3 probe fixed in the magnet steel" PRINT #filenum%, " This is fixed in the magnet. An analog output is read." PRINT #filenum%, " The rms variation of repeated readings is also given." 'Close the file CLOSE filenum% END SUB SUB mapdatztscan (logfile$, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsen%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) '**************************************************************************** 'This subroutine records the data taken during the field map. ' 'Input: ' logfile$, the name of the data file ' zactual!, Z positon of the probes (m) ' tactual!, TH position of the probes (deg) ' imag1!, magnet current from sensor 1 (A) ' simag1!, rms variation of imag1! measurements ' imag2!, magnet current from sensor 2 (A) ' simag2!, rms variation of imag2! measurements ' temp1!, temperature of sensor 1 (deg C) ' temp2!, temperature of sensor 2 (deg C) ' bnmr!, B from the NMR probe (T) ' nsen%, number of Sentron Hall probes ' senname$(1 to nsen%) name of each Sentron Hall probe ' bsen!(1 to nsen%), B from each Sentron Hall probe (T) ' sbsen!(1 to nsen%), rms variation of B measurements (T) ' bgp31!, B from Group 3 #1 (T) ' sbgp31!, rms variation of B from Group 3 #1 (T) ' bgp32!, B from Group 3 #2 (T) ' sbgp32!, rms variation of B from Group 3 #2 (T) ' bgp33!, B from Group 3 #3 (T) ' sbgp33!, rms variation of B from Group 3 #3 (T) ' 'Zachary Wolf '1/23/98 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Write a header on the first call STATIC ncall% ncall% = ncall% + 1 IF ncall% = 1 THEN PRINT #filenum%, PRINT #filenum%, "Column 1, Z_mapper (m)" PRINT #filenum%, "Column 2, THETA_mapper (deg)" PRINT #filenum%, "Column 3, Imag_1 (A)" PRINT #filenum%, "Column 4, sigImag_1 (A)" PRINT #filenum%, "Column 5, Imag_2 (A)" PRINT #filenum%, "Column 6, sigImag_2 (A)" PRINT #filenum%, "Column 7, Probe plate temperature 1 (deg C)" PRINT #filenum%, "Column 8, Probe plate temperature 2 (deg C)" PRINT #filenum%, "Column 9, B_NMR (T)" PRINT #filenum%, "Column 10, Bz_pos1, Rrel = 00.0 cm, Group3 Probe #1 (T), 10^-4 Accuracy" PRINT #filenum%, "Column 11, sigBz_pos1, Rrel = 00.0 cm, Group3 Probe #1 (T), 10^-4 Accuracy" PRINT #filenum%, "Column 12, backupBz_pos3, Rrel = 30.0 cm, Group3 Probe #2 (T), 10^-4 Accuracy" PRINT #filenum%, "Column 13, backupsigBz_pos3, Rrel = 30.0 cm, Group3 Probe #2 (T), 10^-4 Accuracy" FOR i% = 1 TO nsen% PRINT #filenum%, "Column "; LTRIM$(STR$(13 + 2 * i% - 1)); ", "; senname$(i%) PRINT #filenum%, "Column "; LTRIM$(STR$(13 + 2 * i%)); ", sig"; senname$(i%) NEXT i% PRINT #filenum%, PRINT #filenum%, "Begin Data:" END IF 'Write the data PRINT #filenum%, USING " ###.#####"; zactual!; PRINT #filenum%, USING " ####.####"; tactual!; PRINT #filenum%, USING " ######.##"; imag1!; PRINT #filenum%, USING " ######.##"; simag1!; PRINT #filenum%, USING " ######.##"; imag2!; PRINT #filenum%, USING " ######.##"; simag2!; PRINT #filenum%, USING " ###.#####"; temp1!; PRINT #filenum%, USING " ###.#####"; temp2!; PRINT #filenum%, USING " ##.######"; bnmr!; PRINT #filenum%, USING " ##.######"; bgp31!; PRINT #filenum%, USING " ##.######"; sbgp31!; PRINT #filenum%, USING " ##.######"; bgp32!; PRINT #filenum%, USING " ##.######"; sbgp32!; FOR i% = 1 TO nsen% PRINT #filenum%, USING " ##.######"; bsen!(i%); PRINT #filenum%, USING " ##.######"; sbsen!(i%); NEXT i% PRINT #filenum%, 'Close the log file CLOSE filenum% END SUB SUB mapgetzt (nzptsP%, zptsP!(), ntptsP%, tptsP!()) '**************************************************************************** 'This subroutine prompts the operator for the Z and Theta positions for 'the measurements. ' 'Output: ' nzptsP%, the number of Z positions to measure at ' zptsP!(), array of Z measurement positions ' ntptsP%, the number of TH positions to measure at ' tptsP!(), array of TH measurement positions ' 'Zachary Wolf '1/22/98 '**************************************************************************** beginz: 'Get the minimum Z position PRINT PRINT "Enter the minimum Z position (meters): ["; zminP$; "] "; LINE INPUT "", zmin$ IF zmin$ <> "" THEN zminP$ = zmin$ zminP! = VAL(zminP$) 'Get the mazimum Z position PRINT "Enter the maximum Z position (meters): ["; zmaxP$; "] "; LINE INPUT "", zmax$ IF zmax$ <> "" THEN zmaxP$ = zmax$ zmaxP! = VAL(zmaxP$) 'Get the Z step size PRINT "Enter the Z step size (meters): ["; zstepP$; "] "; LINE INPUT "", zstep$ IF zstep$ <> "" THEN zstepP$ = zstep$ zstepP! = VAL(zstepP$) 'Check for consistency IF zmaxP! < zminP! THEN PRINT PRINT "Zmax < Zmin. Try again." GOTO beginz END IF IF zstepP! < 0 THEN PRINT PRINT "Zstep must be greater than or equal to 0. Try again." GOTO beginz END IF 'Check to make sure we don't go past the limits IF zminP! < zminlimitP! THEN PRINT PRINT "Zmin is less than its limit. Zminlimit = "; zminlimitP!; " m" PRINT "Try again." GOTO beginz END IF IF zmaxP! > zmaxlimitP! THEN PRINT PRINT "Zmax is greater than its limit. Zmaxlimit = "; zmaxlimitP!; " m" PRINT "Try again." GOTO beginz END IF 'Calculate the number of Z points IF zstepP! > 0 THEN nzptsP% = 1 + INT((zmaxP! + .00001 - zminP!) / zstepP!) ELSE nzptsP% = 1 END IF 'Check to make sure the user is not asking for too many points IF nzptsP% > maxnzptsP% THEN PRINT PRINT "You are asking for too many Z points." PRINT "Try again." GOTO beginz END IF 'Fill the Z array IF nzptsP% = 1 THEN zptsP!(1) = zminP! ELSE FOR i% = 1 TO nzptsP% zptsP!(i%) = zminP! + (i% - 1) * zstepP! ' zptsP!(i%) = ((i% - 1) * (zmaxP! - zminP!) / (nzptsP% - 1)) + zminP! NEXT i% END IF begint: 'Get the minimum T position PRINT PRINT "Enter the minimum Phi position (deg): ["; tminP$; "] "; LINE INPUT "", tmin$ IF tmin$ <> "" THEN tminP$ = tmin$ tminP! = VAL(tminP$) 'Get the mazimum T position PRINT "Enter the maximum Phi position (deg): ["; tmaxP$; "] "; LINE INPUT "", tmax$ IF tmax$ <> "" THEN tmaxP$ = tmax$ tmaxP! = VAL(tmaxP$) 'Get the T step size PRINT "Enter the Phi step size (deg): ["; tstepP$; "] "; LINE INPUT "", tstep$ IF tstep$ <> "" THEN tstepP$ = tstep$ tstepP! = VAL(tstepP$) 'Check for consistency IF tmaxP! < tminP! THEN PRINT PRINT "Phi_max < Phi_min. Try again." GOTO begint END IF IF tstepP! < 0 THEN PRINT PRINT "Phi_step must be greater than or equal to 0. Try again." GOTO begint END IF 'Check to make sure we don't go past the limits IF tminP! < tminlimitP! THEN PRINT PRINT "Phi_min is less than its limit. Phi_minlimit = "; tminlimitP!; " deg" PRINT "Try again." GOTO begint END IF IF tmaxP! > tmaxlimitP! THEN PRINT PRINT "Phi_max is greater than its limit. Phi_maxlimit = "; tmaxlimitP!; " deg" PRINT "Try again." GOTO begint END IF 'Calculate the number of TH points IF tstepP! > 0 THEN ntptsP% = 1 + INT((tmaxP! + .001 - tminP!) / tstepP!) ELSE ntptsP% = 1 END IF 'Check to make sure the user is not asking for too many points IF ntptsP% > maxntptsP% THEN PRINT PRINT "You are asking for too many Phi points." PRINT "Try again." GOTO begint END IF 'Fill the TH array IF ntptsP% = 1 THEN tptsP!(1) = tminP! ELSE FOR i% = 1 TO ntptsP% tptsP!(i%) = tminP! + (i% - 1) * tstepP! ' tptsP!(i%) = ((i% - 1) * (tmaxP! - tminP!) / (ntptsP% - 1)) + tminP! NEXT i% END IF 'Summarize the results PRINT PRINT "There will be "; nzptsP%; " measurements in Z spaced every "; zstepP!; " m" PRINT "from "; zptsP!(1); " m to "; zptsP!(nzptsP%); " m, inclusive." PRINT PRINT "There will be "; ntptsP%; " measurements in Phi spaced every "; tstepP!; " deg" PRINT "from "; tptsP!(1); " deg to "; tptsP!(ntptsP%); " deg, inclusive." '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 beginz END SUB SUB mapmain '*************************************************************************** 'This subroutine controls the map of the Babar solenoid. ' 'Zachary Wolf '1/20/98 '*************************************************************************** 'Make sure all parameters have been defined CALL mapcheckpar(ok$) IF ok$ <> "y" THEN PRINT PRINT "MAP: problem with the module parameters" EXIT SUB END IF 'Dimension required arrays DIM zptsP!(1 TO maxnzptsP%) DIM tptsP!(1 TO maxntptsP%) DIM bsen!(1 TO nsenP%) DIM sbsen!(1 TO nsenP%) DIM senname$(1 TO nsenP%) 'Get the names of the Sentron probes FOR k% = 1 TO nsenP% CALL sengetname(k%, senname$(k%)) NEXT k% 'Get the Z and TH positions to measure at CALL mapgetzt(nzptsP%, zptsP!(), ntptsP%, tptsP!()) 'Move the mapper to the z home position PRINT PRINT "Moving the mapper to the Z home position, zero the encoder reading..." CALL movezgohome CALL movezzero 'Move the mapper to the theta home position PRINT PRINT "Moving the mapper to the Phi home position, zero the encoder reading..." CALL movethgohome CALL movethzero 'Set the middle of the NMR search range to the nominal field strength PRINT PRINT "Setting up the NMR search range..." CALL pt2025setcoarse(bnmrnomP!) 'Message PRINT PRINT "Beginning the measurement cycle..." SLEEP 1 'Message CLS PRINT PRINT " Z Phi Current Bz_pos3 Bz_pos5 Br_pos5 " PRINT " (m) (deg) (A) (T) (T) (T) " PRINT "--------- --------- --------- --------- --------- ---------" VIEW PRINT 5 TO 22 'Loop over the z positons FOR j% = 1 TO nzptsP% 'Loop over the theta positons FOR i% = 1 TO ntptsP% 'Check for the ESC key IF INKEY$ = CHR$(27) THEN PRINT PRINT "ESCAPE pressed, exiting..." EXIT SUB END IF 'Move to the desired position CALL movezabs(zptsP!(j%)) CALL movethabs(tptsP!(i%)) 'Get the actual mapper location CALL movegetz(zactual!) CALL movegetth(tactual!) 'Get the magnet current CALL ibabgetiav(1, imag1!, simag1!) CALL ibabgetiav(2, imag2!, simag2!) 'Get the probe plate temperatures CALL tbabgett(1, temp1!) CALL tbabgett(2, temp2!) 'Get the NMR probe output CALL pt2025getb(bnmr!) 'Get the Group 3 probe outputs CALL gp3getbav(1, bgp31!, sbgp31!) CALL gp3getbav(2, bgp32!, sbgp32!) 'CALL gp3getbav(3, bgp33!, sbgp33!) 'Get the Sentron Hall probe outputs FOR k% = 1 TO nsenP% CALL sengetbav(k%, bsen!(k%), sbsen!(k%)) NEXT k% 'Message PRINT USING "###.#####"; zactual!; PRINT USING " ####.####"; tactual!; PRINT USING " ######.##"; imag1!; PRINT USING " ####.####"; bsen!(3); PRINT USING " ####.####"; bsen!(5); PRINT USING " ####.####"; bsen!(10) 'Log the results CALL mapdatztscan(datfileP$, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsenP%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) CALL mappltztscan(pltfileP$, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsenP%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) CALL mappltzslice(slicedirP$, i%, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsenP%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) CALL mapplttslice(slicedirP$, j%, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsenP%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) 'Log the system configuration CALL mapdatconfig(slicedirP$) 'Debug 'FOR k% = 1 TO 5 ' bsen!(k%) = 1.5 + k% * .01 'NEXT k% 'FOR k% = 6 TO nsenP% ' bsen!(k%) = k% * .01 'NEXT k% 'CALL mappltzslice(slicedirP$, i%, zptsP!(j%), tptsP!(i%), 10000!, 1!, 20000!, 2!, 21!, 22!, 1!, nsenP%, senname$(), bsen!(), sbsen!(), 3.1, .1, 3.2, .2, 3.3, .3) 'CALL mapplttslice(slicedirP$, j%, zptsP!(j%), tptsP!(i%), 10000!, 1!, 20000!, 2!, 21!, 22!, 1!, nsenP%, senname$(), bsen!(), sbsen!(), 3.1, .1, 3.2, .2, 3.3, .3) 'End loop over stage t positions NEXT i% 'End loop over stage z positions NEXT j% 'End messages VIEW PRINT LOCATE 23, 1 'Move the stages back to their zero positions CALL movezabs(0!) CALL movethabs(0!) END SUB SUB mappltslice (pltslicedir$, slicenum%, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsen%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) '**************************************************************************** 'This subroutine records the data taken during the field map. ' 'Input: ' pltslicedir$, directory for slice info ' slicenum%, slice number ' zactual!, Z positon of the probes (m) ' tactual!, TH position of the probes (deg) ' imag1!, magnet current from sensor 1 (A) ' simag1!, rms variation of imag1! measurements ' imag2!, magnet current from sensor 2 (A) ' simag2!, rms variation of imag2! measurements ' temp1!, temperature of sensor 1 (deg C) ' temp2!, temperature of sensor 2 (deg C) ' bnmr!, B from the NMR probe (T) ' nsen%, number of Sentron Hall probes ' senname$(1 to nsen%) name of each Sentron Hall probe ' bsen!(1 to nsen%), B from each Sentron Hall probe (T) ' sbsen!(1 to nsen%), rms variation of B measurements (T) ' bgp31!, B from Group 3 #1 (T) ' sbgp31!, rms variation of B from Group 3 #1 (T) ' bgp32!, B from Group 3 #2 (T) ' sbgp32!, rms variation of B from Group 3 #2 (T) ' bgp33!, B from Group 3 #3 (T) ' sbgp33!, rms variation of B from Group 3 #3 (T) ' 'Zachary Wolf '1/23/98 '**************************************************************************** 'Open a plot file for each slice STATIC prevslicenum% STATIC prevpltfile$ IF slicenum% <> prevslicenum% THEN slicenum$ = LTRIM$(STR$(slicenum%)) IF slicenum% < 10 THEN slice$ = "SLICE00" + slicenum$ IF slicenum% >= 10 AND slicenum% < 100 THEN slice$ = "SLICE0" + slicenum$ IF slicenum% >= 100 AND slicenum% < 1000 THEN slice$ = "SLICE" + slicenum$ IF slicenum% > 1000 THEN slice$ = "SLI" + slicenum$ runptr% = INSTR(datfileP$, ".") run$ = MID$(datfileP$, runptr%, 4) pltfile$ = pltslicedir$ + "\" + slice$ + run$ prevslicenum% = slicenum% prevpltfile$ = pltfile$ filenum% = FREEFILE OPEN pltfile$ FOR OUTPUT AS filenum% CALL fileplot(pltfile$, "epslice.dat") title$ = pltfile$ ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" PRINT #filenum%, "/et g '" + title$ + "'" ELSE filenum% = FREEFILE OPEN prevpltfile$ FOR APPEND AS filenum% END IF 'Write the data PRINT #filenum%, USING " ###.#####"; zactual!; PRINT #filenum%, USING " ####.####"; tactual!; PRINT #filenum%, USING " ######.##"; imag1!; PRINT #filenum%, USING " ######.##"; simag1!; PRINT #filenum%, USING " ######.##"; imag2!; PRINT #filenum%, USING " ######.##"; simag2!; PRINT #filenum%, USING " ###.#####"; temp1!; PRINT #filenum%, USING " ###.#####"; temp2!; PRINT #filenum%, USING " ##.######"; bnmr!; PRINT #filenum%, USING " ##.######"; bgp31!; PRINT #filenum%, USING " ##.######"; sbgp31!; PRINT #filenum%, USING " ##.######"; bgp32!; PRINT #filenum%, USING " ##.######"; sbgp32!; PRINT #filenum%, USING " ##.######"; bgp33!; PRINT #filenum%, USING " ##.######"; sbgp33!; FOR i% = 1 TO nsen% PRINT #filenum%, USING " ##.######"; bsen!(i%); PRINT #filenum%, USING " ##.######"; sbsen!(i%); NEXT i% PRINT #filenum%, 'Close the log file CLOSE filenum% END SUB SUB mapplttslice (pltslicedir$, slicenum%, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsen%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) '**************************************************************************** 'This subroutine records the data taken during the field map. ' 'Input: ' pltslicedir$, directory for slice info ' slicenum%, slice number ' zactual!, Z positon of the probes (m) ' tactual!, TH position of the probes (deg) ' imag1!, magnet current from sensor 1 (A) ' simag1!, rms variation of imag1! measurements ' imag2!, magnet current from sensor 2 (A) ' simag2!, rms variation of imag2! measurements ' temp1!, temperature of sensor 1 (deg C) ' temp2!, temperature of sensor 2 (deg C) ' bnmr!, B from the NMR probe (T) ' nsen%, number of Sentron Hall probes ' senname$(1 to nsen%) name of each Sentron Hall probe ' bsen!(1 to nsen%), B from each Sentron Hall probe (T) ' sbsen!(1 to nsen%), rms variation of B measurements (T) ' bgp31!, B from Group 3 #1 (T) ' sbgp31!, rms variation of B from Group 3 #1 (T) ' bgp32!, B from Group 3 #2 (T) ' sbgp32!, rms variation of B from Group 3 #2 (T) ' bgp33!, B from Group 3 #3 (T) ' sbgp33!, rms variation of B from Group 3 #3 (T) ' 'Zachary Wolf '1/23/98 '**************************************************************************** 'Name the file to save the slice data in slicenum$ = LTRIM$(STR$(slicenum%)) IF slicenum% < 10 THEN slice$ = "PSLICE0" + slicenum$ IF slicenum% >= 10 AND slicenum% < 100 THEN slice$ = "PSLICE" + slicenum$ IF slicenum% >= 100 AND slicenum% < 1000 THEN slice$ = "PSLIC" + slicenum$ IF slicenum% >= 1000 THEN slice$ = "PSLI" + slicenum$ runptr% = INSTR(datfileP$, ".") run$ = MID$(datfileP$, runptr%, 4) pltfile$ = pltslicedir$ + "\" + slice$ + run$ 'Open a plot file for each slice CALL fileexist(pltfile$, yn$) IF yn$ = "n" THEN filenum% = FREEFILE OPEN pltfile$ FOR OUTPUT AS filenum% ELSE filenum% = FREEFILE OPEN pltfile$ FOR APPEND AS filenum% END IF 'When created, write a title for the plot and add the file to the plot list IF yn$ = "n" THEN CALL fileplot(pltfile$, "eptslice.dat") title$ = pltfile$ ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" PRINT #filenum%, "/et g '" + title$ + "'" END IF 'Write the data PRINT #filenum%, USING " ###.#####"; zactual!; PRINT #filenum%, USING " ####.####"; tactual!; PRINT #filenum%, USING " ######.##"; imag1!; PRINT #filenum%, USING " ######.##"; simag1!; PRINT #filenum%, USING " ######.##"; imag2!; PRINT #filenum%, USING " ######.##"; simag2!; PRINT #filenum%, USING " ###.#####"; temp1!; PRINT #filenum%, USING " ###.#####"; temp2!; PRINT #filenum%, USING " ##.######"; bnmr!; PRINT #filenum%, USING " ##.######"; bgp31!; PRINT #filenum%, USING " ##.######"; sbgp31!; PRINT #filenum%, USING " ##.######"; bgp32!; PRINT #filenum%, USING " ##.######"; sbgp32!; 'PRINT #filenum%, USING " ##.######"; bgp33!; 'PRINT #filenum%, USING " ##.######"; sbgp33!; FOR i% = 1 TO nsen% PRINT #filenum%, USING " ##.######"; bsen!(i%); PRINT #filenum%, USING " ##.######"; sbsen!(i%); NEXT i% PRINT #filenum%, 'Close the log file CLOSE filenum% END SUB SUB mappltzslice (pltslicedir$, slicenum%, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsen%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) '**************************************************************************** 'This subroutine records the data taken during the field map. ' 'Input: ' pltslicedir$, directory for slice info ' slicenum%, slice number ' zactual!, Z positon of the probes (m) ' tactual!, TH position of the probes (deg) ' imag1!, magnet current from sensor 1 (A) ' simag1!, rms variation of imag1! measurements ' imag2!, magnet current from sensor 2 (A) ' simag2!, rms variation of imag2! measurements ' temp1!, temperature of sensor 1 (deg C) ' temp2!, temperature of sensor 2 (deg C) ' bnmr!, B from the NMR probe (T) ' nsen%, number of Sentron Hall probes ' senname$(1 to nsen%) name of each Sentron Hall probe ' bsen!(1 to nsen%), B from each Sentron Hall probe (T) ' sbsen!(1 to nsen%), rms variation of B measurements (T) ' bgp31!, B from Group 3 #1 (T) ' sbgp31!, rms variation of B from Group 3 #1 (T) ' bgp32!, B from Group 3 #2 (T) ' sbgp32!, rms variation of B from Group 3 #2 (T) ' bgp33!, B from Group 3 #3 (T) ' sbgp33!, rms variation of B from Group 3 #3 (T) ' 'Zachary Wolf '1/23/98 '**************************************************************************** 'Name the file to save the slice data in slicenum$ = LTRIM$(STR$(slicenum%)) IF slicenum% < 10 THEN slice$ = "ZSLICE0" + slicenum$ IF slicenum% >= 10 AND slicenum% < 100 THEN slice$ = "ZSLICE" + slicenum$ IF slicenum% >= 100 AND slicenum% < 1000 THEN slice$ = "ZSLIC" + slicenum$ IF slicenum% >= 1000 THEN slice$ = "ZSLI" + slicenum$ runptr% = INSTR(datfileP$, ".") run$ = MID$(datfileP$, runptr%, 4) pltfile$ = pltslicedir$ + "\" + slice$ + run$ 'Open a plot file for each slice CALL fileexist(pltfile$, yn$) IF yn$ = "n" THEN filenum% = FREEFILE OPEN pltfile$ FOR OUTPUT AS filenum% ELSE filenum% = FREEFILE OPEN pltfile$ FOR APPEND AS filenum% END IF 'When created, write a title for the plot and add the file to the plot list IF yn$ = "n" THEN CALL fileplot(pltfile$, "epzslice.dat") title$ = pltfile$ ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" ptr% = INSTR(title$, "\") MID$(title$, ptr%, 1) = "/" PRINT #filenum%, "/et g '" + title$ + "'" END IF 'Write the data PRINT #filenum%, USING " ###.#####"; zactual!; PRINT #filenum%, USING " ####.####"; tactual!; PRINT #filenum%, USING " ######.##"; imag1!; PRINT #filenum%, USING " ######.##"; simag1!; PRINT #filenum%, USING " ######.##"; imag2!; PRINT #filenum%, USING " ######.##"; simag2!; PRINT #filenum%, USING " ###.#####"; temp1!; PRINT #filenum%, USING " ###.#####"; temp2!; PRINT #filenum%, USING " ##.######"; bnmr!; PRINT #filenum%, USING " ##.######"; bgp31!; PRINT #filenum%, USING " ##.######"; sbgp31!; PRINT #filenum%, USING " ##.######"; bgp32!; PRINT #filenum%, USING " ##.######"; sbgp32!; 'PRINT #filenum%, USING " ##.######"; bgp33!; 'PRINT #filenum%, USING " ##.######"; sbgp33!; FOR i% = 1 TO nsen% PRINT #filenum%, USING " ##.######"; bsen!(i%); PRINT #filenum%, USING " ##.######"; sbsen!(i%); NEXT i% PRINT #filenum%, 'Close the log file CLOSE filenum% END SUB SUB mappltztscan (logfile$, zactual!, tactual!, imag1!, simag1!, imag2!, simag2!, temp1!, temp2!, bnmr!, nsen%, senname$(), bsen!(), sbsen!(), bgp31!, sbgp31!, bgp32!, sbgp32!, bgp33!, sbgp33!) '**************************************************************************** 'This subroutine records the data taken during the field map. ' 'Input: ' logfile$, the name of the data file ' zactual!, Z positon of the probes (m) ' tactual!, TH position of the probes (deg) ' imag1!, magnet current from sensor 1 (A) ' simag1!, rms variation of imag1! measurements ' imag2!, magnet current from sensor 2 (A) ' simag2!, rms variation of imag2! measurements ' temp1!, temperature of sensor 1 (deg C) ' temp2!, temperature of sensor 2 (deg C) ' bnmr!, B from the NMR probe (T) ' nsen%, number of Sentron Hall probes ' senname$(1 to nsen%) name of each Sentron Hall probe ' bsen!(1 to nsen%), B from each Sentron Hall probe (T) ' sbsen!(1 to nsen%), rms variation of B measurements (T) ' bgp31!, B from Group 3 #1 (T) ' sbgp31!, rms variation of B from Group 3 #1 (T) ' bgp32!, B from Group 3 #2 (T) ' sbgp32!, rms variation of B from Group 3 #2 (T) ' bgp33!, B from Group 3 #3 (T) ' sbgp33!, rms variation of B from Group 3 #3 (T) ' 'Zachary Wolf '1/23/98 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Write the data PRINT #filenum%, USING " ###.#####"; zactual!; PRINT #filenum%, USING " ####.####"; tactual!; PRINT #filenum%, USING " ######.##"; imag1!; PRINT #filenum%, USING " ######.##"; simag1!; PRINT #filenum%, USING " ######.##"; imag2!; PRINT #filenum%, USING " ######.##"; simag2!; PRINT #filenum%, USING " ###.#####"; temp1!; PRINT #filenum%, USING " ###.#####"; temp2!; PRINT #filenum%, USING " ##.######"; bnmr!; PRINT #filenum%, USING " ##.######"; bgp31!; PRINT #filenum%, USING " ##.######"; sbgp31!; PRINT #filenum%, USING " ##.######"; bgp32!; PRINT #filenum%, USING " ##.######"; sbgp32!; 'PRINT #filenum%, USING " ##.######"; bgp33!; 'PRINT #filenum%, USING " ##.######"; sbgp33!; FOR i% = 1 TO nsen% PRINT #filenum%, USING " ##.######"; bsen!(i%); PRINT #filenum%, USING " ##.######"; sbsen!(i%); NEXT i% PRINT #filenum%, 'Close the log file CLOSE filenum% END SUB SUB mapsetpar (datfile$, logfile$, pltfile$, slicedir$, zminlimit!, zmaxlimit!, tminlimit!, tmaxlimit!, bnmrnom!, nsen%) '**************************************************************************** 'This subroutine sets the parameters for the MAP module. ' 'Input: ' datfile$, data file ' logfile$, log file ' pltfile$, plot file ' slicedir$, directory for slice info ' zminlimit!, minimum Z value of the mapper (m) ' zmaxlimit!, maximum Z value of the mapper (m) ' tminlimit!, minimum TH value of the mapper (deg) ' tmaxlimit!, maximum TH value of the mapper (deg) ' bnmrnom!, nominal field strength for NMR searches (T) ' nsen%, number of Sentron Hall probes ' 'Zachary Wolf '1/25/98 '**************************************************************************** 'Save the information in a common block for future use datfileP$ = datfile$ logfileP$ = logfile$ pltfileP$ = pltfile$ slicedirP$ = slicedir$ zminlimitP! = zminlimit! zmaxlimitP! = zmaxlimit! tminlimitP! = tminlimit! tmaxlimitP! = tmaxlimit! bnmrnomP! = bnmrnom! nsenP% = nsen% END SUB