DECLARE SUB vcoilgetf (f!) DECLARE SUB vcoilgetv2 (coilid%, v2!) DECLARE SUB blcalcratio (nh%, bln!(), sbln!(), nmain%, rn!(), srn!()) DECLARE SUB bldatblhar (datfile$, imag!, simag!, nmain%, nh%, bln!(), sbln!(), thn!(), sthn!(), r!(), sr!()) DECLARE SUB bldatview (logfile$, nmain%, thsp!, viewdir$) DECLARE SUB blgetblnav (nh%, bln!(), sbln!(), thn!(), sthn!()) DECLARE SUB blpltblhar (pltfile$, legend$, nh%, rn!(), srn!()) DECLARE SUB qpolcalcxy (nh%, bl!(), sbl!(), th!(), sth!(), x!, sx!, y!, sy!) DECLARE SUB qpolcheckpar (ok$) DECLARE SUB qpoldatglvsi (datfile$, imag!, simag!, gl!, sgl!, tf!, stf!) DECLARE SUB qpoldatxy (logfile$, th!(), x!, sx!, y!, sy!) DECLARE SUB qpolgetgl (gl!) DECLARE SUB qpolgetglav (gl!, sgl!) DECLARE SUB qpollogcalc (logfile$) DECLARE SUB qpolloggl (logfile$, coilconst!, f!, v2!, gl!) DECLARE SUB qpollogglav (logfile$, gl!, sgl!) DECLARE SUB qpollogstrmeas (logfile$) DECLARE SUB qpolpltglvsi (pltfile$, imag!, gl!, sgl!, tf!, stf!) DECLARE SUB imaggetiav (imag!, simag!) DECLARE SUB imagramp (inom!) DECLARE SUB filenewpage (filename$) '**************************************************************************** 'Module QPOL.BAS ' 'These subroutines perform calculations related to quadrupole magnet 'measurements. ' 'Zachary Wolf '1/2/95 '**************************************************************************** 'Put the required parameters for this module in a common block COMMON SHARED /qpol/ logfileP$, strdatfileP$, strpltfileP$, hardatfileP$, harpltfileP$, magnameP$, runP$, strcoilidP%, strqpolcoilconstP!, harcoilradiusmP!, blnmeasaveP%, nimagtestP%, imagtestP!(), imagharflagP!(), nhardisplayP%, viewdirP$ SUB qpolcalcxy (nh%, bl!(), sbl!(), th!(), sth!(), x!, sx!, y!, sy!) '**************************************************************************** 'This subroutine calculates the (x, y) position of the quadrupole magnetic 'center relative to the coil axis. X is horizontal to the right (viewed 'from the encoder end) and Y is up. ' 'Input: ' nh%, the number of voltage harmonics recorded ' bl!(1 to nh%), the integrated strength of each harmonic at the coil radius (T) ' sbl!(1 to nh%), rms variation of bl ' th!(1 to nh%), the angle of the first south pole of each harmonic wrt horizontal (deg) ' sth!(1 to nh%), rms variation of th ' 'Output: ' x!, x coordinate of the magnetic center wrt the coil axis (m) ' sx!, calculated error for x ' y!, y coordinate of the magnetic center wrt the coil axis (m) ' sy!, calculated error for y ' 'Zachary Wolf '1/2/94 '**************************************************************************** 'Simplify the notation pi! = 3.1415926# 'Coil parameters rcoil! = harcoilradiusmP! 'Compute gl from bl(2) gl! = bl!(2) / rcoil! sgl! = sbl!(2) / rcoil! 'Compute the magnetic center relative to the coil 'For a normal quad (th(2) = 45 deg): x! = -(1! / gl!) * bl!(1) * SIN(th!(1) * pi! / 180!) y! = -(1! / gl!) * bl!(1) * COS(th!(1) * pi! / 180!) 'With the leads reversed, the signs change IF th!(2) < 0 THEN x! = -x! y! = -y! END IF 'Compute the error on the magnetic center sx! = ABS(x!) * SQR((sgl! / gl!) ^ 2 + (sbl!(1) / bl!(1)) ^ 2 + (COS(th!(1) * pi! / 180!) / (SIN(th!(1) * pi! / 180!) + .000001)) ^ 2 * (sth!(1) * pi! / 180!) ^ 2) sy! = ABS(y!) * SQR((sgl! / gl!) ^ 2 + (sbl!(1) / bl!(1)) ^ 2 + (SIN(th!(1) * pi! / 180!) / (COS(th!(1) * pi! / 180!) + .000001)) ^ 2 * (sth!(1) * pi! / 180!) ^ 2) END SUB SUB qpolcheckpar (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" 'Files IF logfileP$ = "" OR strdatfileP$ = "" OR strpltfileP$ = "" OR hardatfileP$ = "" OR harpltfileP$ = "" THEN PRINT "QPOL: required file not defined" EXIT SUB END IF 'Runinfo IF magnameP$ = "" OR runP$ = "" THEN PRINT "QPOL: required run parameter not defined" EXIT SUB END IF 'Coil IF strcoilidP% <= 0 OR strqpolcoilconstP! <= 0 OR harcoilradiusmP! <= 0 THEN PRINT "QPOL: required coil parameter not defined" EXIT SUB END IF 'Measurement parameters IF blnmeasaveP% <= 0 OR nhardisplayP% <= 0 OR nimagtestP% <= 0 THEN PRINT "QPOL: required measurement parameter not defined" EXIT SUB END IF 'Main harmonic picture IF viewdirP$ <> "LEADEND" AND viewdirP$ <> "NONLEADEND" THEN PRINT "QPOL: unknown view direction" EXIT SUB END IF 'If we made it this far, all parameters have values ok$ = "y" END SUB SUB qpoldatglvsi (datfile$, imag!, simag!, gl!, sgl!, tf!, stf!) '**************************************************************************** 'This subroutine writes a gl measurement at Imag to the data file. ' 'Input: ' datfile$, the name of the data file ' imag!, the measured current ' simag!, the standard deviation of imag ' gl!, the integrated gradient at the measured current ' sgl!, the standard deviation of gl ' tf!, GL/I ' stf!, the standard deviation of TF ' 'Zachary Wolf '11/19/95 '**************************************************************************** 'Keep track of Ncall so a header can be written on the first call STATIC ncall% ncall% = ncall% + 1 'Open the log file filenum% = FREEFILE OPEN datfile$ FOR APPEND AS filenum% 'On the first call, write a header for the hysteresis loop IF ncall% = 1 THEN PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, " INTEGRATED GRADIENT VS CURRENT" PRINT #filenum%, PRINT #filenum%, " Imag sigImag GL sigGL GL/I sigGL/I " PRINT #filenum%, " (A) (A) (T) (T) (T/kA) (T/kA) " PRINT #filenum%, "--------+-------- --------+-------- --------+--------" END IF 'Write the result PRINT #filenum%, USING "####.###"; imag!; PRINT #filenum%, USING " ####.###"; simag!; PRINT #filenum%, USING " ##.#####"; gl!; PRINT #filenum%, USING " ##.#####"; sgl!; PRINT #filenum%, USING " ###.####"; tf! * 1000!; PRINT #filenum%, USING " ###.####"; stf! * 1000! 'Close the log file CLOSE filenum% END SUB SUB qpoldatxy (logfile$, th!(), x!, sx!, y!, sy!) '**************************************************************************** 'This subroutine writes the (x, y) location of the magnetic center 'relative to the coil to the log file. ' 'Input: ' logfile$, file to print results ' th!(1 to nh%), gives the orientation of the quadrupole field ' x!, x position of the magnetic center wrt the coil axis ' sx!, error on x ' y!, y position of the magnetic center wrt the coil axis ' sy!, error on y ' 'Zachary Wolf '1/4/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the magnetic center to the log file PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, "The magnetic center is at" PRINT #filenum%, "X = "; PRINT #filenum%, USING "#####.#"; x! * 1000000!; PRINT #filenum%, " +- "; PRINT #filenum%, USING "#####.#"; sx! * 1000000!; PRINT #filenum%, " microns" PRINT #filenum%, "Y = "; PRINT #filenum%, USING "#####.#"; y! * 1000000!; PRINT #filenum%, " +- "; PRINT #filenum%, USING "#####.#"; sy! * 1000000!; PRINT #filenum%, " microns" PRINT #filenum%, PRINT #filenum%, "The magnetic center is measured relative to the coil axis" PRINT #filenum%, "effectively at the longitudinal center of the magnet." PRINT #filenum%, "Pitch and yaw are not seen by the coil." 'Print the following diagram 'PRINT #filenum%, 'PRINT #filenum%, "View from the non-lead end of the magnet:" 'PRINT #filenum%, 'IF th!(2) > 0 THEN ' PRINT #filenum%, " y " ' PRINT #filenum%, " ^ " ' PRINT #filenum%, " | " ' PRINT #filenum%, " N S " ' PRINT #filenum%, ' PRINT #filenum%, " --> x " ' PRINT #filenum%, ' PRINT #filenum%, " S N " 'ELSE ' PRINT #filenum%, " y " ' PRINT #filenum%, " ^ " ' PRINT #filenum%, " | " ' PRINT #filenum%, " S N " ' PRINT #filenum%, ' PRINT #filenum%, " --> x " ' PRINT #filenum%, ' PRINT #filenum%, " N S " 'END IF 'Close the log file CLOSE filenum% END SUB SUB qpolgetgl (gl!) '**************************************************************************** 'This subroutine calculates the integrated quadrupole strength from the 'measured coil voltage at the second harmonic. ' 'Output: ' gl!, the integrated gradient (T) ' 'Zachary Wolf '11/19/95 '**************************************************************************** 'Make sure all parameters have been defined with acceptable values CALL qpolcheckpar(ok$) IF ok$ <> "y" THEN EXIT SUB 'Calculation Of GL: 'V2 = Nturns * velocity * B2 * L ' = Nturns * Rcoil * ang_freq * GL * Rcoil ' = Nturns * Rcoil^2 * ang_freq * GL 'GL = V2 / (Nturns * Rcoil^2 * ang_freq) 'For a double coil (for coil bowing correction), 'V2 = [(Nturns * Rcoil^2)1 + (Nturns * Rcoil^2)2] * ang_freq * GL 'GL = [(Nturns * Rcoil^2)1 + (Nturns * Rcoil^2)2]^(-1) * (V2 / ang_freq) 'Let CoilConst = [(Nturns * Rcoil^2)1 + (Nturns * Rcoil^2)2]^(-1) 'GL = CoilConst * V2 / ang_freq 'Simplify the notation pi! = 3.1415926# 'Measure the coil rotation frequency CALL vcoilgetf(f1!) SLEEP 1 CALL vcoilgetf(f2!) 'Get the coil voltage at the second harmonic CALL vcoilgetv2(strcoilidP%, v2!) 'Measure the coil rotation frequency again after the coil voltage CALL vcoilgetf(f3!) 'Compute the average of the coil rotation frequency measurements f! = (f1! + f2! + f3!) / 3! 'Compute GL gl! = strqpolcoilconstP! * v2! / (2 * pi! * f!) 'Log the result CALL qpolloggl(logfileP$, strqpolcoilconstP!, f!, v2!, gl!) END SUB SUB qpolgetglav (gl!, sgl!) '**************************************************************************** 'This subroutine has GL measured several times, then it computes the 'average and rms variation. ' 'Output: ' gl!, average of the GL measurements ' sgl!, rms variation of the GL measurements ' 'Zachary Wolf '11/21/95 '**************************************************************************** 'Make sure all parameters have been defined with acceptable values CALL qpolcheckpar(ok$) IF ok$ <> "y" THEN EXIT SUB 'Log that a strength measurement is being made CALL qpollogstrmeas(logfileP$) 'Simplify the notation nm% = blnmeasaveP% 'Initialize data arrays DIM glmeas!(1 TO nm%) 'Message about the measurement number PRINT PRINT "Performing GL measurement #"; 'Loop over the measurements FOR i% = 1 TO nm% 'Message about the measurement number PRINT USING " #"; i%; 'Measure GL CALL qpolgetgl(gl!) 'Store the results glmeas!(i%) = gl! 'End the loop over the measurements NEXT i% 'End message info PRINT 'Compute averages gl! = 0! FOR i% = 1 TO nm% gl! = gl! + glmeas!(i%) NEXT i% gl! = gl! / nm% 'Compute rms deviations sgl! = 0! FOR i% = 1 TO nm% sgl! = sgl! + (glmeas!(i%) - gl!) ^ 2 NEXT i% sgl! = SQR(sgl! / nm%) 'Print the result to the screen PRINT "Integrated gradient GL = "; gl!; " +- "; sgl!; " T" 'Log the result CALL qpollogglav(logfileP$, gl!, sgl!) END SUB SUB qpollogcalc (logfile$) '**************************************************************************** 'This subroutine summarizes the calculations used in the program. ' 'Inputs: ' logfile$, the name of the log file ' 'Zachary Wolf '9/22/94, 12/3/94, 6/3/97 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Header PRINT #filenum%, PRINT #filenum%, " SUMMARY OF THE CALCULATIONS AND CONVENTIONS USED" 'Summarize the calculations used for GL vs I PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, "Calculation Of GL:" PRINT #filenum%, "V2 = Nturns * velocity * B2 * L" PRINT #filenum%, " = Nturns * Rcoil * ang_freq * GL * Rcoil" PRINT #filenum%, " = Nturns * Rcoil^2 * ang_freq * GL" PRINT #filenum%, "GL = V2 / (Nturns * Rcoil^2 * ang_freq)" PRINT #filenum%, "For a double coil (for coil bowing correction)," PRINT #filenum%, "V2 = [(Nturns * Rcoil^2)1 + (Nturns * Rcoil^2)2] * ang_freq * GL" PRINT #filenum%, "GL = [(Nturns * Rcoil^2)1 + (Nturns * Rcoil^2)2]^(-1) * (V2 / ang_freq)" PRINT #filenum%, "Let CoilConst = [(Nturns * Rcoil^2)1 + (Nturns * Rcoil^2)2]^(-1)" PRINT #filenum%, "GL = CoilConst * V2 / ang_freq" 'Harmonics PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, "Calculation Of The Harmonics:" PRINT #filenum%, "Magnitude, harmonic n:" PRINT #filenum%, "Vn = Nturns * velocity * Bn * L" PRINT #filenum%, " = Nturns * Rcoil * ang_freq * (BLn)" PRINT #filenum%, "BLn = Vn / (Nturns * Rcoil * ang_freq)" PRINT #filenum%, "Rn = BLn / BL2 = Vn / V2" PRINT #filenum%, PRINT #filenum%, "Phase, harmonic n:" PRINT #filenum%, "At the coil radius, the radial field as a function of angle is," PRINT #filenum%, "BLn(th) = BLn * cos(n*(th - THspole))" PRINT #filenum%, "The coil voltage Vn(th) = Nturns * velocity * BLn(th)" PRINT #filenum%, "Vn(th) = Nturns * Rcoil * ang_freq * BLn * cos(n*(th - THspole))" PRINT #filenum%, "The FFT gives Vn and PhiVn in the formula" PRINT #filenum%, "Vn(i) = Vn * cos(n*2pi*i/N + PhiVn)" PRINT #filenum%, "So, Nturns * Rcoil * ang_freq * BLn = Vn" PRINT #filenum%, " -n * THspole = PhiVn" PRINT #filenum%, "Or, BLn = Vn / (Nturns * Rcoil * ang_freq)" PRINT #filenum%, " THspole = -PhiVn / n" 'Magnetic center PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, "Calculation Of The Magnetic Center:" PRINT #filenum%, "In the quadrupole's frame, Bx' = G * y', By' = G * x'." PRINT #filenum%, "In the coil's frame (unprimed frame) the magnetic center is at (x0, y0)." PRINT #filenum%, "In the coil's frame," PRINT #filenum%, " Bx = G * (y - y0), By = G * (x - x0)." PRINT #filenum%, "This gives the magnetic center in terms of the measured" PRINT #filenum%, "dipole field." PRINT #filenum%, " x0 = - By / G, y0 = - Bx / G" PRINT #filenum%, "In terms of the measured integrated strengths," PRINT #filenum%, " Xcenter = - (1/GL) * BL1 * sin(THspole1)" PRINT #filenum%, " Ycenter = - (1/GL) * BL1 * cos(THspole1)" 'Close the log file CLOSE filenum% END SUB SUB qpolloggl (logfile$, coilconst!, f!, v2!, gl!) '**************************************************************************** 'This subroutine writes a GL measurement to the log file. ' 'Input: ' logfile$, the name of the log file ' coilconst!, coil constant ' f!, coil rotation frequency ' v2!, coil voltage at the second harmonic ' gl!, integrated gradient ' 'Zachary Wolf '11/19/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the results PRINT #filenum%, TIME$; " Integrated Gradient Measurement:" PRINT #filenum%, " CoilConst = "; coilconst!; " 1/m^2, Fcoil = "; f!; " Hz, V2 = "; v2!; " V" PRINT #filenum%, " GL = "; gl!; " T" 'Close the log file CLOSE filenum% END SUB SUB qpollogglav (logfile$, gl!, sgl!) '**************************************************************************** 'This subroutine writes a summary of an average GL measurement to the log file. ' 'Input: ' logfile$, the name of the log file ' gl!, the average of the integrated gradient measurements ' sgl!, the rms variation of gl ' 'Zachary Wolf '11/19/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the results PRINT #filenum%, TIME$; " Average Integrated Gradient:" PRINT #filenum%, " GL = "; gl!; " +- "; sgl!; " T" 'Close the log file CLOSE filenum% END SUB SUB qpollogstrmeas (logfile$) '**************************************************************************** 'This subroutine records a measurement to the log file. ' 'Input: ' logfile$, the name of the log file ' 'Zachary Wolf '11/25/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the results PRINT #filenum%, PRINT #filenum%, TIME$; " Magnet Strength Measurement..." 'Close the log file CLOSE filenum% END SUB SUB qpolmain '**************************************************************************** 'This subroutine controls the magnetic measurements of a quadrupole at 'various currents. ' 'Zachary Wolf '1/4/95, 5/6/95 '**************************************************************************** 'Make sure all parameters have been defined with acceptable values CALL qpolcheckpar(ok$) IF ok$ <> "y" THEN EXIT SUB 'Message PRINT PRINT "Beginning the quadrupole field measurement cycle..." 'Simplify the notation ni% = nimagtestP% nh% = nhardisplayP% 'Initialize data arrays DIM bln!(1 TO nh%) 'field strength at Rcoil of the n'th harmonic DIM sbln!(1 TO nh%) 'standard deviation of Bn DIM thn!(1 TO nh%) 'field angle DIM sthn!(1 TO nh%) 'standard deviation of THn DIM rn!(1 TO nh%) 'BLn/BL2 DIM srn!(1 TO nh%) 'standard deviation of rn 'Loop over test currents FOR i% = 1 TO ni% 'Ramp to the desired current CALL imagramp(imagtestP!(i%)) 'Measure the current CALL imaggetiav(imag!, simag!) 'Get the integrated gradient CALL qpolgetglav(gl!, sgl!) 'Compute the transfer function IF imag! <> 0! THEN tf! = gl! / imag! stf! = tf! * SQR((sgl! / gl!) ^ 2 + (simag! / imag!) ^ 2) ELSE tf! = 0! stf! = 0! END IF 'Write the strength measurement to the data file CALL qpoldatglvsi(strdatfileP$, imag!, simag!, gl!, sgl!, tf!, stf!) 'Write the strength measurement to the plot file CALL qpolpltglvsi(strpltfileP$, imag!, gl!, sgl!, tf!, stf!) 'Do the following only if the harmonics are desired IF imagharflagP!(i%) > 0 THEN 'Get the field harmonics at the coil radius CALL blgetblnav(nh%, bln!(), sbln!(), thn!(), sthn!()) 'Compute the strength ratios of the harmonics CALL blcalcratio(nh%, bln!(), sbln!(), nmain%, rn!(), srn!()) 'Compute the location of the magnetic center CALL qpolcalcxy(nh%, bln!(), sbln!(), thn!(), sthn!(), x!, sx!, y!, sy!) 'Write the harmonics to the data file CALL bldatblhar(hardatfileP$, imag!, simag!, nmain%, nh%, bln!(), sbln!(), thn!(), sthn!(), rn!(), srn!()) 'Write a picture of the main harmonic under the table of harmonics CALL bldatview(hardatfileP$, nmain%, thn!(nmain%), viewdirP$) 'Write the magnetic center to the data file CALL qpoldatxy(hardatfileP$, thn!(), x!, sx!, y!, sy!) 'Write the harmonics to the plot file legend$ = "I = " + STR$(imagtestP!(i%)) + " A" CALL blpltblhar(harpltfileP$, legend$, nh%, rn!(), srn!()) 'End harmonics check END IF 'End loop over currents NEXT i% 'Write a summary of the calculations to the GL data file CALL filenewpage(strdatfileP$) CALL qpollogcalc(strdatfileP$) 'Write a summary of the calculations to the harmonics data file CALL filenewpage(hardatfileP$) CALL qpollogcalc(hardatfileP$) END SUB SUB qpolpltglvsi (pltfile$, imag!, gl!, sgl!, tf!, stf!) '**************************************************************************** 'This subroutine write a summary of the GL vs I measurements for plotting. ' 'Input: ' pltfile$, the name of the plot file ' imag!, the measured current ' gl!, the integrated gradient at the measured current ' sgl!, the standard deviation of gl ' tf!, the transfer function at the measured current ' stf!, the standard deviation of tf ' 'Zachary Wolf '11/19/95 '**************************************************************************** 'Keep track of Ncall for the header STATIC ncall% ncall% = ncall% + 1 'Open the plot file filenum% = FREEFILE OPEN pltfile$ FOR APPEND AS filenum% 'Write the title for plotting on the first call IF ncall% = 1 THEN PRINT #filenum%, "/et g '" + magnameP$ + ", Run " + runP$ + "'" PRINT #filenum%, ";i gl sgl tf stf" END IF 'Write the values PRINT #filenum%, USING "####.#"; imag!; PRINT #filenum%, USING " ##.#####"; gl!; PRINT #filenum%, USING " ##.#####"; sgl!; PRINT #filenum%, USING " ###.#####"; tf!; PRINT #filenum%, USING " ###.#####"; stf! 'Close the log file CLOSE filenum% END SUB SUB qpolsetpar (logfile$, strdatfile$, strpltfile$, hardatfile$, harpltfile$, magname$, run$, strcoilid%, strqpolcoilconst!, harcoilradiusm!, blnmeasave%, nimagtest%, imagtest!(), imagharflag!(), nhardisplay%, viewdir$) '**************************************************************************** 'This subroutine sets the parameters required by this module. ' 'Input: ' logfile$, path and name of the log file ' strdatfile$, magnet strength data file ' strpltfile$, magnet strength plot file ' hardatfile$, harmonics data file ' harpltfile$, harmonics plot file ' magname$, magnet name ' run$, run number ' strcoilid%, strength coil ID number ' strqpolcoilconst!, strength coil quadrupole coil constant ' harcoilradiusm!, harmonics coil radius (m) ' blnmeasave%, number of measurements for averaging ' nimagtest%, number of test currents ' imagtest!(), test currents ' imagharflag!(), flag for harmonics measurement ' nhardisplay%, number of harmonics to record ' viewdir$, view direction for picture of main harmonic ' 'Zachary Wolf '11/20/95 '**************************************************************************** 'Set the parameters logfileP$ = logfile$ strdatfileP$ = strdatfile$ strpltfileP$ = strpltfile$ hardatfileP$ = hardatfile$ harpltfileP$ = harpltfile$ magnameP$ = magname$ runP$ = run$ strcoilidP% = strcoilid% strqpolcoilconstP! = strqpolcoilconst! harcoilradiusmP! = harcoilradiusm! blnmeasaveP% = blnmeasave% nimagtestP% = nimagtest% DIM imagtestP!(1 TO nimagtestP%) DIM imagharflagP!(1 TO nimagtestP%) FOR i% = 1 TO nimagtestP% imagtestP!(i%) = imagtest!(i%) imagharflagP!(i%) = imagharflag!(i%) NEXT i% nhardisplayP% = nhardisplay% viewdirP$ = viewdir$ END SUB