DECLARE SUB vaximagramp (imag!) DECLARE SUB bllogmeasbl (logfile$, imag!, simag!, vt!, svt!, bl!, sbl!, tf!, stf!) DECLARE SUB bllogmeasure (logfile$, ni%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) DECLARE SUB blmeasbl (imag!, simag!, vt!, svt!, bl!, sbl!, tf!, stf!) DECLARE SUB blplotmeasure (logfile$, magname$, run$, ni%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) DECLARE SUB coilmeasvt (vt!, sigvt!) DECLARE SUB imagmeas (imag!, simag!) DECLARE SUB imagramp (inom!) DECLARE SUB bllogtrim (logfile$, ni%, imag!(), itrim!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) DECLARE SUB blplottrim (logfile$, magname$, run$, imain!, ni%, itrim!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) DECLARE SUB itrimmeas (itrim!, sitrim!) '**************************************************************************** 'Module BL ' 'Zachary Wolf '6/3/94 '**************************************************************************** 'Open the parameter file REM $INCLUDE: 'param.inc' SUB bllogmeasbl (logfile$, imag!, simag!, vt!, svt!, bl!, sbl!, tf!, stf!) '**************************************************************************** 'This subroutine logs a BL measurement. ' 'Input: ' logfile$, the name of the log file ' imag!, the measured magnet current ' vt!, the measured integrated voltage from the coil ' svt!, the standard deviation of vt! measurements ' bl!, the magnet integrated field strength ' sbl!, the standard deviation of bl! ' tf!, the magnet transfer function, bl!/imag! ' stf!, the standard deviation of tf! ' 'Zachary Wolf '3/19/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Message PRINT #filenum%, PRINT #filenum%, TIME$; " Integrated Field Strength Measurement:" PRINT #filenum%, "The magnet current is Imag = "; imag!; " +- "; simag!; " A" PRINT #filenum%, "The integrated voltage is VT = "; vt!; " +- "; svt!; " Vs" PRINT #filenum%, "The integrated field strength is BL = "; bl!; " +- "; sbl!; " Tm" PRINT #filenum%, "The transfer function is TF = "; tf!; " +- "; stf!; " Tm/A" 'Close the log file CLOSE filenum% END SUB SUB bllogmeasure (logfile$, ni%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) '**************************************************************************** 'This subroutine writes the bl measurement log file. ' 'Inputs: ' logfile$, the name of the log file ' ni%, the number of currents ' imag!(1 to ni%), the measured currents ' vt!(1 to ni%), the integrated voltages ' svt!(1 to ni%), the standard deviation on the measured integrated voltage ' bl!(1 to ni%), the integrated field strengths ' sbl!(1 to ni%), the standard deviation on the integrated field strength ' tf!(1 to ni%), the magnet transfer function BL/I ' stf!(1 to ni%), the standard deviation on the transfer function ' 'Zachary Wolf '5/4/94, 6/2/94, 12/29/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Title PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, PRINT #filenum%, " INTEGRATED FIELD STRENGTH MEASUREMENTS" 'Write the header PRINT #filenum%, PRINT #filenum%, " I VT sigVT BL sigBL BL/I sigBL/I " PRINT #filenum%, " (A) (VS) (VS) (TM) (TM) (TM/KA) (TM/KA) " PRINT #filenum%, "------- --------+-------- --------+-------- --------+--------" 'Write the values FOR i% = 1 TO ni% 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 " ##.#####"; tf!(i%) * 1000!; PRINT #filenum%, USING " ##.#####"; stf!(i%) * 1000! NEXT i% 'Close the log file CLOSE filenum% END SUB SUB blmeasbl (imag!, simag!, vt!, svt!, bl!, sbl!, tf!, stf!) '**************************************************************************** 'This subroutine measures imag, vt, and svt. 'The integrated field strength is calculated. 'The transfer function is calculated. 'The standard deviation of each quantity is calculated. 'Constants come from param.inc. ' 'Output: ' imag!, the measured magnet current ' vt!, the measured integrated voltage from the coil ' svt!, the standard deviation of vt! measurements ' bl!, the magnet integrated field strength ' sbl!, the standard deviation of bl! ' tf!, the magnet transfer function, bl!/imag! ' stf!, the standard deviation of tf! ' 'Zachary Wolf '11/25/94 '**************************************************************************** 'Measure the magnet current CALL imagmeas(imag!, simag!) 'Message PRINT PRINT "Measuring the integrated field strength..." 'Measure the coil voltage integral CALL coilmeasvt(vt!, svt!) 'Compute the integrated field strength bl! = vt! * coilconstP! sbl! = svt! * coilconstP! 'Compute the transfer function tf! = bl! / imag! stf! = sbl! / imag! 'Message PRINT PRINT "Integrated Field Strength Measurement:" PRINT "The magnet current is Imag = "; imag!; " +- "; simag!; " A" PRINT "The integrated voltage is VT = "; vt!; " +- "; svt!; " Vs" PRINT "The integrated field strength is BL = "; bl!; " +- "; sbl!; " Tm" PRINT "The transfer function is TF = "; tf!; " +- "; stf!; " Tm/A" 'Log the result CALL bllogmeasbl(logfileP$, imag!, simag!, vt!, svt!, bl!, sbl!, tf!, stf!) END SUB SUB blmeasure '**************************************************************************** 'This subroutine controls the measurement of the integrated field strength 'as a function of current for the B-Factory Injection Line dipoles. 'Constants come from param.inc. ' 'Zachary Wolf '11/25/94 '**************************************************************************** 'Message PRINT PRINT "Beginning the measurement cycle..." 'Simplify the notation ni% = nimagblP% 'Initialize data arrays DIM imag!(1 TO ni%) 'measured magnet current DIM vt!(1 TO ni%) 'integrated voltage DIM svt!(1 TO ni%) 'standard deviation DIM bl!(1 TO ni%) 'integrated field strength DIM sbl!(1 TO ni%) 'standard deviation DIM tf!(1 TO ni%) 'transfer function BL/I DIM stf!(1 TO ni%) 'standard deviation 'Loop over currents FOR i% = 1 TO ni% 'Ramp to the desired current CALL vaximagramp(imagblP!(i%)) 'Make a measurement CALL blmeasbl(imag!(i%), simag!, vt!(i%), svt!(i%), bl!(i%), sbl!(i%), tf!(i%), stf!(i%)) 'End loop over currents NEXT i% 'Write the results to the log file and data file CALL bllogmeasure(logfileP$, ni%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) CALL bllogmeasure(datfileP$, ni%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) 'Write the results to the plotting file CALL blplotmeasure(pltfileP$, magnameP$, runP$, ni%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) END SUB SUB blplotmeasure (logfile$, magname$, run$, ni%, imag!(), vt!(), svt!(), bl!(), sbl!(), tf!(), stf!()) '**************************************************************************** 'This subroutine writes the BL measurement plot file for plotting. ' 'Inputs: ' logfile$, the name of the log file ' magname$, magnet name ' run$, run number ' ni%, the number of currents ' imag!(1 to ni%), the current the magnet was measured at ' vt!(1 to ni%), the integrated voltage measurements ' svt!(1 to ni%), standard deviation on vt! ' bl!(1 to ni%), the integrated field strengths ' sbl!(1 to ni%), the error on bl! ' tf!(1 to ni%), the transfer function ' stf!(1 to ni%), the error on tf! ' 'Zachary Wolf '5/12/94, 6/2/94, 12/29/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$ + "'" PRINT #filenum%, ";i bl sbl tf stf" 'Write the values FOR i% = 1 TO ni% PRINT #filenum%, USING "####.##"; imag!(i%); PRINT #filenum%, USING " ##.#####"; bl!(i%); PRINT #filenum%, USING " ##.#####"; sbl!(i%); PRINT #filenum%, USING " ##.#####"; tf!(i%) * 1000!; PRINT #filenum%, USING " ##.#####"; stf!(i%) * 1000! NEXT i% 'Close the log file CLOSE filenum% END SUB