SUB logd (logfile$, nz%, z!(), d1!(), d2!(), d3!(), d4!(), rincl!(), d1c!(), d2c!(), d3c!(), d4c!()) '**************************************************************************** 'This subroutine writes the gap measurements and corrected gap measurements 'to the log file. ' 'Inputs: ' logfile$, the name of the log file ' nz%, the number of z positions ' d1!(0 TO nz%+1), distance from upper outer sensor to the pole ' d2!(0 TO nz%+1), distance from upper inner sensor to the pole ' d3!(0 TO nz%+1), distance from lower inner sensor to the pole ' d4!(0 TO nz%+1), distance from lower outer sensor to the pole ' rincl!(0 to nz%+1), the roll angle of the measurement arm in mrad ' d1c!(0 TO nz%+1), corrected distance from upper outer sensor to the pole ' d2c!(0 TO nz%+1), corrected distance from upper inner sensor to the pole ' d3c!(0 TO nz%+1), corrected distance from lower inner sensor to the pole ' d4c!(0 TO nz%+1), corrected distance from lower outer sensor to the pole ' 'Zachary Wolf '6/24/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Start on a new page PRINT #filenum%, CHR$(12) 'Write the header PRINT #filenum%, PRINT #filenum%, "Sensor to Surface Raw and Corrected Distances" PRINT #filenum%, PRINT #filenum%, " z d1to d2ti d3bi d4bo Rarm d1cto d2cti d3cbi d4cbo" PRINT #filenum%, " (in) (mils) (mils) (mils) (mils) (mrad) (mils) (mils) (mils) (mils)" PRINT #filenum%, "------ ------ ------ ------ ------ ------- ------ ------ ------ ------" 'Write the values for the initial home position PRINT #filenum%, "Initial home position values:" PRINT #filenum%, USING "####.#"; z!(0); PRINT #filenum%, USING " ###.##"; d1!(0); PRINT #filenum%, USING " ###.##"; d2!(0); PRINT #filenum%, USING " ###.##"; d3!(0); PRINT #filenum%, USING " ###.##"; d4!(0); PRINT #filenum%, USING " ##.####"; rincl!(0); PRINT #filenum%, USING " ###.##"; d1c!(0); PRINT #filenum%, USING " ###.##"; d2c!(0); PRINT #filenum%, USING " ###.##"; d3c!(0); PRINT #filenum%, USING " ###.##"; d4c!(0) 'Write the values from the magnet PRINT #filenum%, PRINT #filenum%, "Values in the magnet:" FOR i% = 1 TO nz% PRINT #filenum%, USING "####.#"; z!(i%); PRINT #filenum%, USING " ###.##"; d1!(i%); PRINT #filenum%, USING " ###.##"; d2!(i%); PRINT #filenum%, USING " ###.##"; d3!(i%); PRINT #filenum%, USING " ###.##"; d4!(i%); PRINT #filenum%, USING " ##.####"; rincl!(i%); PRINT #filenum%, USING " ###.##"; d1c!(i%); PRINT #filenum%, USING " ###.##"; d2c!(i%); PRINT #filenum%, USING " ###.##"; d3c!(i%); PRINT #filenum%, USING " ###.##"; d4c!(i%) NEXT i% 'Write the values from the final home position PRINT #filenum%, PRINT #filenum%, "Final home position values:" PRINT #filenum%, USING "####.#"; z!(nz% + 1); PRINT #filenum%, USING " ###.##"; d1!(nz% + 1); PRINT #filenum%, USING " ###.##"; d2!(nz% + 1); PRINT #filenum%, USING " ###.##"; d3!(nz% + 1); PRINT #filenum%, USING " ###.##"; d4!(nz% + 1); PRINT #filenum%, USING " ##.####"; rincl!(nz% + 1); PRINT #filenum%, USING " ###.##"; d1c!(nz% + 1); PRINT #filenum%, USING " ###.##"; d2c!(nz% + 1); PRINT #filenum%, USING " ###.##"; d3c!(nz% + 1); PRINT #filenum%, USING " ###.##"; d4c!(nz% + 1) 'Write the changes PRINT #filenum%, "Changes from initial values:" PRINT #filenum%, USING "####.#"; z!(nz% + 1) - z!(0); PRINT #filenum%, USING " ###.##"; d1!(nz% + 1) - d1!(0); PRINT #filenum%, USING " ###.##"; d2!(nz% + 1) - d2!(0); PRINT #filenum%, USING " ###.##"; d3!(nz% + 1) - d3!(0); PRINT #filenum%, USING " ###.##"; d4!(nz% + 1) - d4!(0); PRINT #filenum%, USING " ##.####"; rincl!(nz% + 1) - rincl!(0); PRINT #filenum%, USING " ###.##"; d1c!(nz% + 1) - d1c!(0); PRINT #filenum%, USING " ###.##"; d2c!(nz% + 1) - d2c!(0); PRINT #filenum%, USING " ###.##"; d3c!(nz% + 1) - d3c!(0); PRINT #filenum%, USING " ###.##"; d4c!(nz% + 1) - d4c!(0) 'Close the log file CLOSE filenum% END SUB SUB logg (logfile$, nz%, z!(), gout!(), goutave!, goutsig!, gin!(), ginave!, ginsig!, gm!(), gmave!, gmsig!, grad!(), gradave!, gradsig!) '**************************************************************************** 'This subroutine writes the gap measurement log file. ' 'Inputs: ' logfile$, the name of the log file ' nz%, the number of z positions ' z!(0 to nz%+1), z positions ' gout!(0 tO nz%+1), outer gap ' goutave!, average outer gap ' goutsig!, standard deviations of the outer gap values ' gin!(0 tO nz%+1), inner gap ' ginave!, average inner gap ' ginsig!, standard deviation of the inner gap values ' gm!(0 to nz%+1), middle gap ' gmave!, average middle gap ' gmsig!, standard deviation of the middle gap values ' grad!(1 to nz%), the fractional gradient of the gap ' gradave!, average fractional gradient ' gradsig!, standard deviation of the gradient values ' 'Zachary Wolf '6/24/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Start on a new page PRINT #filenum%, CHR$(12) 'Write the header PRINT #filenum%, PRINT #filenum%, "Gap Measurements" PRINT #filenum%, PRINT #filenum%, " z Gout Gin Gm 1/G dG/dx " PRINT #filenum%, " (in) (mils) (mils) (mils) (1/m) " PRINT #filenum%, "------ -------- -------- -------- -----------" 'Write the values from the initial home position PRINT #filenum%, "Initial home position values:" PRINT #filenum%, USING "####.#"; z!(0); PRINT #filenum%, USING " ####.#"; gout!(0); PRINT #filenum%, USING " ####.#"; gin!(0); PRINT #filenum%, USING " ####.#"; gm!(0); PRINT #filenum%, USING " ##.######"; grad!(0) 'Write the values from the magnet PRINT #filenum%, PRINT #filenum%, "Values in the magnet:" FOR i% = 1 TO nz% PRINT #filenum%, USING "####.#"; z!(i%); PRINT #filenum%, USING " ####.#"; gout!(i%); PRINT #filenum%, USING " ####.#"; gin!(i%); PRINT #filenum%, USING " ####.#"; gm!(i%); PRINT #filenum%, USING " ##.######"; grad!(i%) NEXT i% 'Write the values from the final home position PRINT #filenum%, PRINT #filenum%, "Final home position values:" PRINT #filenum%, USING "####.#"; z!(nz% + 1); PRINT #filenum%, USING " ####.#"; gout!(nz% + 1); PRINT #filenum%, USING " ####.#"; gin!(nz% + 1); PRINT #filenum%, USING " ####.#"; gm!(nz% + 1); PRINT #filenum%, USING " ##.######"; grad!(nz% + 1) 'Write the changes from the initial values PRINT #filenum%, "Changes from initial values:" PRINT #filenum%, USING "####.#"; z!(nz% + 1) - z!(0); PRINT #filenum%, USING " ####.#"; gout!(nz% + 1) - gout!(0); PRINT #filenum%, USING " ####.#"; gin!(nz% + 1) - gin!(0); PRINT #filenum%, USING " ####.#"; gm!(nz% + 1) - gm!(0); PRINT #filenum%, USING " ##.######"; grad!(nz% + 1) - grad!(0) 'Write the average values and standard deviations PRINT #filenum%, PRINT #filenum%, "Average Values and Standard Deviations:" PRINT #filenum%, "Average Outer Gap Width, Gout = "; goutave!; " +- "; goutsig!; " mils" PRINT #filenum%, "Average Inner Gap Width, Gin = "; ginave!; " +- "; ginsig!; " mils" PRINT #filenum%, "Average Middle Gap Width, Gm = "; gmave!; " +- "; gmsig!; " mils" PRINT #filenum%, "Average Gradient, 1/G dG/dx = "; gradave!; " +- "; gradsig!; " 1/m" 'Close the log file CLOSE filenum% END SUB SUB loghr (logfile$, nz%, z!(), hout!(), houtave!, houtsig!, hin!(), hinave!, hinsig!, roll!(), rollave!, rollsig!) '**************************************************************************** 'This subroutine writes the elevation measurements and roll angle 'measurements to the log file. ' 'Inputs: ' logfile$, the name of the log file ' nz%, the number of z positions ' z!(0 to nz%+1), the z positions ' hout!(0 TO nz%+1), outer vertical height of gap center ' houtave!, average hout ' houtsig!, standard deviation of hout values ' hin!(0 TO nz%+1), inner vertical height of gap center ' hinave!, average hin ' hinsig!, standard deviation of hin values ' roll!(0 to nz%+1), roll angle ' rollave!, average roll angle ' rollsig!, standard deviation of the roll angle values ' 'Zachary Wolf '6/24/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Start on a new page PRINT #filenum%, CHR$(12) 'Write the header PRINT #filenum%, PRINT #filenum%, "Height and Roll Measurements" PRINT #filenum%, PRINT #filenum%, " z Hout Hin Roll " PRINT #filenum%, " (in) (mils) (mils) (mrad) " PRINT #filenum%, "------ -------- -------- --------" 'Write the values from the initial home position PRINT #filenum%, "Initial home position values:" PRINT #filenum%, USING "####.#"; z!(0); PRINT #filenum%, USING " ###.##"; hout!(0); PRINT #filenum%, USING " ###.##"; hin!(0); PRINT #filenum%, USING " ###.##"; roll!(0) 'Write the values from the magnet PRINT #filenum%, PRINT #filenum%, "Values in the magnet:" FOR i% = 1 TO nz% PRINT #filenum%, USING "####.#"; z!(i%); PRINT #filenum%, USING " ###.##"; hout!(i%); PRINT #filenum%, USING " ###.##"; hin!(i%); PRINT #filenum%, USING " ###.##"; roll!(i%) NEXT i% 'Write the values from the final home position PRINT #filenum%, PRINT #filenum%, "Final home position values:" PRINT #filenum%, USING "####.#"; z!(nz% + 1); PRINT #filenum%, USING " ###.##"; hout!(nz% + 1); PRINT #filenum%, USING " ###.##"; hin!(nz% + 1); PRINT #filenum%, USING " ###.##"; roll!(nz% + 1) 'Write the changes from the initial readings PRINT #filenum%, "Changes from the initial values:" PRINT #filenum%, USING "####.#"; z!(nz% + 1) - z!(0); PRINT #filenum%, USING " ###.##"; hout!(nz% + 1) - hout!(0); PRINT #filenum%, USING " ###.##"; hin!(nz% + 1) - hin!(0); PRINT #filenum%, USING " ###.##"; roll!(nz% + 1) - roll!(0) 'Write the average values PRINT #filenum%, PRINT #filenum%, "Average Values and Standard Deviations:" PRINT #filenum%, "(Heights are relative to the ideal magnet elevation.)" PRINT #filenum%, "Average Outer Midplane Height, Hout = "; houtave!; " +- "; houtsig!; " mils" PRINT #filenum%, "Average Inner Midplane Height, Hin = "; hinave!; " +- "; hinsig!; " mils" PRINT #filenum%, "Average Roll Angle, Roll = "; rollave!; " +- "; rollsig!; " mrad" 'Insert a page break PRINT #filenum%, CHR$(12) 'Close the log file CLOSE filenum% END SUB SUB logplot (logfile$, magname$, run$, nz%, z!(), d1!(), d2!(), d3!(), d4!(), gout!(), gin!(), hout!(), hin!(), roll!()) '**************************************************************************** 'This subroutine writes the gap measurement data file for plotting. ' 'Inputs: ' logfile$, the name of the log file ' magname$, magnet name ' run$, run number ' nz%, the number of z positions ' d1!(0 TO nz%+1), distance from upper outer sensor to the pole ' d2!(0 TO nz%+1), distance from upper inner sensor to the pole ' d3!(0 TO nz%+1), distance from lower inner sensor to the pole ' d4!(0 TO nz%+1), distance from lower outer sensor to the pole ' gout!(0 TO nz%+1), outer gap ' gin!(0 TO nz%+1), inner gap ' hout!(0 TO nz%+1), outer vertical height of gap center ' hin!(0 TO nz%+1), inner vertical height of gap center ' roll!(0 to nz%+1), the roll angle of the median plane in mrad ' 'Zachary Wolf '5/5/94, 6/24/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 values FOR i% = 1 TO nz% PRINT #filenum%, USING "####.#"; z!(i%); PRINT #filenum%, USING " ####.##"; d1!(i%); PRINT #filenum%, USING " ####.##"; d2!(i%); PRINT #filenum%, USING " ####.##"; -d3!(i%); PRINT #filenum%, USING " ####.##"; -d4!(i%); PRINT #filenum%, USING " #####.#"; gout!(i%); PRINT #filenum%, USING " #####.#"; gin!(i%); PRINT #filenum%, USING " ###.##"; hout!(i%); PRINT #filenum%, USING " ###.##"; hin!(i%); PRINT #filenum%, USING " ###.####"; roll!(i%) NEXT i% 'Close the log file CLOSE filenum% END SUB SUB logshim (logfile$, mr!, br!, mh!, bh!, shimr1!, shimr2!, shimh1!, shimh2!) '**************************************************************************** 'This subroutine writes the shim thicknesses to the gap measurement log file. ' 'Inputs: ' logfile$, the name of the log file ' mr!, slope of fitted line to roll vs z ' br!, intercept of fitted line to roll vs z ' mh!, slope of fitted line to height vs z ' bh!, intercept of fitted line to height vs z ' shimr1!, required lead end shim thickness to take out roll and twist ' shimr2!, required return end shim thickness to take out roll and twist ' shimh1!, required lead end shim thickness to take out elevation and pitch ' shimh2!, required return end shim thickness to take out elevation and pitch ' 'Zachary Wolf '5/5/94, 6/24/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Title PRINT #filenum%, PRINT #filenum%, "Shims" 'Roll and twist shims PRINT #filenum%, PRINT #filenum%, "Fit to Roll vs z:" PRINT #filenum%, "R(z) = "; mr!; " * z + "; br! PRINT #filenum%, "Shims to make the roll and twist zero:" PRINT #filenum%, "Foot 1, shimr1 = "; shimr1!; " mils" PRINT #filenum%, "Foot 2, shimr2 = "; shimr2!; " mils" 'Height and pitch shims PRINT #filenum%, PRINT #filenum%, "Fit to Hout vs z:" PRINT #filenum%, "Hin(z) = "; mh!; " * z + "; bh! PRINT #filenum%, "Shims to make the height and pitch zero:" PRINT #filenum%, "Foot 1, shimh1 = "; shimh1!; " mils" PRINT #filenum%, "Foot 2, shimh2 = "; shimh2!; " mils" 'Calculate total shims sa% = shimr1! + shimh1! sb% = shimh1! sc% = shimr2! + shimh2! sd% = shimh2! 'Shim summary PRINT #filenum%, PRINT #filenum%, "Shim Values For Each Support Point:" PRINT #filenum%, PRINT #filenum%, " Upstream End" PRINT #filenum%, " Inside Outside" PRINT #filenum%, PRINT #filenum%, "Foot 1 "; sa%; " "; sb%; " mils" PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, "Foot 2 "; sc%; " "; sd%; " mils" PRINT #filenum%, PRINT #filenum%, " Downstream End" 'Close the log file CLOSE filenum% END SUB SUB logsumm (logfile$, goutave!, goutsig!, ginave!, ginsig!, gmave!, gmsig!, gradave!, gradsig!, houtave!, houtsig!, hinave!, hinsig!, ht1w!, ht1a!, ht2w!, ht2a!, rollave!, rollsig!) '**************************************************************************** 'This subroutine writes the gap measurement log file. ' 'Inputs: ' logfile$, the name of the log file ' goutave!, average outer gap ' goutsig!, standard deviations of the outer gap values ' ginave!, average inner gap ' ginsig!, standard deviation of the inner gap values ' gmave!, average middle gap ' gmsig!, standard deviation of the middle gap values ' gradave!, average fractional gradient ' gradsig!, standard deviation of the gradient values ' houtave!, average hout ' houtsig!, standard deviation of hout values ' hinave!, average hin ' hinsig!, standard deviation of hin values ' ht1w!, height of alignment target at foot 1 on the wall side ' ht1a!, height of alignment target at foot 1 on the aisle side ' ht2w!, height of alignment target at foot 2 on the wall side ' ht2a!, height of alignment target at foot 2 on the aisle side ' rollave!, average roll angle ' rollsig!, standard deviation of the roll angle values ' 'Zachary Wolf '6/24/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Write the average gap values and standard deviations PRINT #filenum%, PRINT #filenum%, "Average Gap Values and Standard Deviations:" PRINT #filenum%, "Average Outer Gap Width, Gout = "; goutave!; " +- "; goutsig!; " mils" PRINT #filenum%, "Average Inner Gap Width, Gin = "; ginave!; " +- "; ginsig!; " mils" PRINT #filenum%, "Average Middle Gap Width, Gm = "; gmave!; " +- "; gmsig!; " mils" PRINT #filenum%, "Average Gradient, 1/G dG/dx = "; gradave!; " +- "; gradsig!; " 1/m" 'Write the average height values and standard deviations PRINT #filenum%, PRINT #filenum%, "Average Height Values and Standard Deviations:" PRINT #filenum%, "(Heights are relative to the ideal magnet elevation.)" PRINT #filenum%, "Average Outer Midplane Height, Hout = "; houtave!; " +- "; houtsig!; " mils" PRINT #filenum%, "Average Inner Midplane Height, Hin = "; hinave!; " +- "; hinsig!; " mils" 'Write the average roll value and standard deviation PRINT #filenum%, PRINT #filenum%, "Average Roll Angle and Standard Deviation:" PRINT #filenum%, "Average Roll Angle, Roll = "; rollave!; " +- "; rollsig!; " mrad" 'Write the alignment target height values PRINT #filenum%, PRINT #filenum%, "Alignment Target Heights (relative to ideal):" PRINT #filenum%, "Target Heights At Foot 1, HT1W = "; ht1w!; ", HT1A = "; ht1a!; " mils" PRINT #filenum%, "Target Heights At Foot 2, HT2W = "; ht2w!; ", HT2A = "; ht2a!; " mils" 'Close the log file CLOSE filenum% END SUB SUB logv (logfile$, nz%, z!(), v1!(), v2!(), v3!(), v4!(), vincl!()) '**************************************************************************** 'This subroutine records the gap sensor voltages and the inclinometer 'voltage to the log file. ' 'Inputs: ' logfile$, the name of the log file ' nz%, the number of z positions in the magnet ' z!(0 to nz%+1), the z position at which the measurement was taken ' v1!(0 to nz%+1), voltage from the upper outer sensor ' v2!(0 to nz%+1), voltage from the upper inner sensor ' v3!(0 to nz%+1), voltage from the lower inner sensor ' v4!(0 to nz%+1), voltage from the lower outer sensor ' vincl!(0 to nz%+1), voltage from the inclinometer ' 'Zachary Wolf '6/24/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Write column labels PRINT #filenum%, PRINT #filenum%, "Sensor Voltages" PRINT #filenum%, " z V1uo V2ui V3li V4lo Vincl " PRINT #filenum%, " (in) (V) (V) (V) (V) (V) " PRINT #filenum%, "------- ------- ------- ------- ------- -------" 'Write the initial home position values to the log file PRINT #filenum%, "Initial home position values:" PRINT #filenum%, USING "####.##"; z!(0); PRINT #filenum%, USING " ##.####"; v1!(0); PRINT #filenum%, USING " ##.####"; v2!(0); PRINT #filenum%, USING " ##.####"; v3!(0); PRINT #filenum%, USING " ##.####"; v4!(0); PRINT #filenum%, USING " ##.####"; vincl!(0) 'Write the values from the magnet to the log file PRINT #filenum%, PRINT #filenum%, "Values in the magnet:" FOR i% = 1 TO nz% PRINT #filenum%, USING "####.##"; z!(i%); PRINT #filenum%, USING " ##.####"; v1!(i%); PRINT #filenum%, USING " ##.####"; v2!(i%); PRINT #filenum%, USING " ##.####"; v3!(i%); PRINT #filenum%, USING " ##.####"; v4!(i%); PRINT #filenum%, USING " ##.####"; vincl!(i%) NEXT i% 'Write the values to the log file PRINT #filenum%, PRINT #filenum%, "Final home position values:" PRINT #filenum%, USING "####.##"; z!(nz% + 1); PRINT #filenum%, USING " ##.####"; v1!(nz% + 1); PRINT #filenum%, USING " ##.####"; v2!(nz% + 1); PRINT #filenum%, USING " ##.####"; v3!(nz% + 1); PRINT #filenum%, USING " ##.####"; v4!(nz% + 1); PRINT #filenum%, USING " ##.####"; vincl!(nz% + 1) 'Write the changes to the log file PRINT #filenum%, "Changes from initial values:" PRINT #filenum%, USING "####.##"; z!(nz% + 1) - z!(0); PRINT #filenum%, USING " ##.####"; v1!(nz% + 1) - v1!(0); PRINT #filenum%, USING " ##.####"; v2!(nz% + 1) - v2!(0); PRINT #filenum%, USING " ##.####"; v3!(nz% + 1) - v3!(0); PRINT #filenum%, USING " ##.####"; v4!(nz% + 1) - v4!(0); PRINT #filenum%, USING " ##.####"; vincl!(nz% + 1) - vincl!(0); 'Close the log file CLOSE filenum% END SUB