DECLARE SUB rtplt (logfile$, cycle%, tim!, imag!, vmag!, rmag!, t1!, t2!, t3!, t4!, t5!) DECLARE SUB rtdat (logfile$, cycle%, tim$, imag!, vmag!, rmag!, t1!, t2!, t3!, t4!, t5!) DECLARE SUB imaggeti (imag!) DECLARE SUB imagramp (inom!) DECLARE SUB vmaggetv (vmag!) DECLARE SUB tmaggettn (n%, tn!) '**************************************************************************** 'Module RT.BAS 'This module performs the resistance and temperature measurements. '**************************************************************************** 'Open the parameter file REM $INCLUDE: 'param.inc' 'Required parameters 'CONST tbtwnmeassecP% = 60 '# seconds between RT measurements 'Make file names common to all procedures 'COMMON SHARED /filenames/ logfileP$, rawfileP$, rtdatP$, sldatP$, slpltP$, hardatP$, harpltP$ SUB rtdat (logfile$, cycle%, tim$, imag!, vmag!, rmag!, t1!, t2!, t3!, t4!, t5!) '**************************************************************************** 'This subroutine writes the resistance and temperature measurements 'to the log file. ' 'Inputs: ' logfile$, the name of the log file ' cycle%, the cycle number ' tim$, the time the measurement was taken ' imag!, the magnet current ' vmag!, the magnet voltage ' rmag!, the magnet resistance ' t1!, temperature T1 in deg C ' t2!, temperature T2 in deg C ' t3!, temperature T3 in deg C ' t4!, temperature T4 in deg C ' t5!, temperature T5 in deg C ' 'Zachary Wolf '9/6/94, 12/2/94, 5/8/95 '**************************************************************************** 'Keep track of Ncall for header STATIC ncall% ncall% = ncall% + 1 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'On the first call, write the header IF ncall% = 1 THEN PRINT #filenum%, PRINT #filenum%, " Resistance and Temperature Measurements " PRINT #filenum%, PRINT #filenum%, "T1 = "; t1P$ PRINT #filenum%, "T2 = "; t2P$ PRINT #filenum%, "T3 = "; t3P$ PRINT #filenum%, "T4 = "; t4P$ PRINT #filenum%, "T5 = "; t5P$ PRINT #filenum%, PRINT #filenum%, " N Time Imag Vmag Rmag T1 T2 T3 T4 T5 " PRINT #filenum%, " (A) (V) (mohm) (dg C) (dg C) (dg C) (dg C) (dg C)" PRINT #filenum%, "--- -------- ------- ------- ------- ------ ------ ------ ------ ------" END IF 'Write the values PRINT #filenum%, USING "###"; cycle%; PRINT #filenum%, USING " &"; tim$; PRINT #filenum%, USING " ####.##"; imag!; PRINT #filenum%, USING " ###.###"; vmag!; PRINT #filenum%, USING " ###.###"; rmag! * 1000!; PRINT #filenum%, USING " ###.##"; t1!; PRINT #filenum%, USING " ###.##"; t2!; PRINT #filenum%, USING " ###.##"; t3!; PRINT #filenum%, USING " ###.##"; t4!; PRINT #filenum%, USING " ###.##"; t5! 'Close the log file CLOSE filenum% END SUB SUB rtmain '**************************************************************************** 'This subroutine controls the resistance and temperature measurements. ' 'Zachary Wolf '9/6/94, 12/2/94, 1/5/95 '**************************************************************************** 'Message PRINT PRINT "Beginning the magnet resistance and temperature measurement cycle..." 'Get the desired current 'getinom: 'PRINT 'INPUT "What current do you wish to ramp to? (0 1000 THEN ' PRINT : PRINT "The current must be between 0 85 deg C WHILE t2! < 85! 'Check if the run should end early IF INKEY$ = CHR$(27) THEN EXIT FOR 'Message PRINT : PRINT PRINT "Time: "; TIME$; " Resistance and Temperature measurement: Cycle #"; i% 'Record the time of the measurement tim$ = TIME$ tm! = TIMER 'TEMPERATURE MEASUREMENTS 'Measure T1 CALL tmaggettn(1, t1!) 'Measure T2 CALL tmaggettn(2, t2!) 'Measure T3 CALL tmaggettn(3, t3!) 'Measure T4 CALL tmaggettn(4, t4!) 'Measure T5 CALL tmaggettn(5, t5!) 'MAGNET RESISTANCE MEASUREMENTS 'Measure and store the magnet current CALL imaggeti(imag!) 'Measure the magnet voltage CALL vmaggetv(vmag!) 'Compute the magnet resistance rmag! = vmag! / imag! 'Write the results to the screen 'PRINT 'PRINT "Resistance and Temperature Measurements" 'PRINT "T1 = "; t1P$ 'PRINT "T2 = "; t2P$ 'PRINT "T3 = "; t3P$ 'PRINT "T4 = "; t4P$ 'PRINT "T5 = "; t5P$ 'PRINT " Cycle #"; i% PRINT PRINT " Imag Vmag Rmag T1 T2 T3 T4 T5 " PRINT " (A) (V) (mohm) (deg C) (deg C) (deg C) (deg C) (deg C)" PRINT "------- ------- ------- ------- ------- ------- ------- -------" PRINT USING "####.##"; imag!; PRINT USING " ###.###"; vmag!; PRINT USING " ###.###"; rmag! * 1000!; PRINT USING " ####.##"; t1!; PRINT USING " ####.##"; t2!; PRINT USING " ####.##"; t3!; PRINT USING " ####.##"; t4!; PRINT USING " ####.##"; t5! 'Write the results to the plot file CALL rtplt(rtpltP$, i%, tm! - tm0!, imag!, vmag!, rmag!, t1!, t2!, t3!, t4!, t5!) 'Ramp the magnet IF t2! < 70 THEN CALL imagramp(950!) IF t2! >= 70 THEN CALL imagramp(875!) 'IF t2! >= 45 AND t2! < 65 THEN CALL imagramp(800!) 'IF t2! >= 65 THEN CALL imagramp(750!) 'Wait between measurements WHILE TIMER - tm! < tbtwnmeassecP% WEND 'End loop over repeated measurements WEND 'Write the final measurements to the data file CALL rtdat(rtdatP$, i%, tim$, imag!, vmag!, rmag!, t1!, t2!, t3!, t4!, t5!) 'DOWN RAMP 'Message PRINT PRINT "DOWN RAMP" 'Ramp the magnet CALL imagramp(0!) 'Measure until T2 < 25 deg C WHILE t2! > 25! 'Check if the run should end early IF INKEY$ = CHR$(27) THEN EXIT FOR 'Message PRINT : PRINT PRINT "Time: "; TIME$; " Resistance and Temperature measurement: Cycle #"; i% 'Record the time of the measurement tim$ = TIME$ tm! = TIMER 'TEMPERATURE MEASUREMENTS 'Measure T1 CALL tmaggettn(1, t1!) 'Measure T2 CALL tmaggettn(2, t2!) 'Measure T3 CALL tmaggettn(3, t3!) 'Measure T4 CALL tmaggettn(4, t4!) 'Measure T5 CALL tmaggettn(5, t5!) 'MAGNET RESISTANCE MEASUREMENTS 'Measure and store the magnet current CALL imaggeti(imag!) 'Measure the magnet voltage CALL vmaggetv(vmag!) 'Compute the magnet resistance rmag! = vmag! / imag! 'Write the results to the screen 'PRINT 'PRINT "Resistance and Temperature Measurements" 'PRINT "T1 = "; t1P$ 'PRINT "T2 = "; t2P$ 'PRINT "T3 = "; t3P$ 'PRINT "T4 = "; t4P$ 'PRINT "T5 = "; t5P$; " Cycle #"; i% PRINT PRINT " Imag Vmag Rmag T1 T2 T3 T4 T5 " PRINT " (A) (V) (mohm) (deg C) (deg C) (deg C) (deg C) (deg C)" PRINT "------- ------- ------- ------- ------- ------- ------- -------" PRINT USING "####.##"; imag!; PRINT USING " ###.###"; vmag!; PRINT USING " ###.###"; rmag! * 1000!; PRINT USING " ####.##"; t1!; PRINT USING " ####.##"; t2!; PRINT USING " ####.##"; t3!; PRINT USING " ####.##"; t4!; PRINT USING " ####.##"; t5! 'Write the results to the plot file CALL rtplt(rtpltP$, i%, tm! - tm0!, imag!, vmag!, rmag!, t1!, t2!, t3!, t4!, t5!) 'Wait between measurements WHILE TIMER - tm! < tbtwnmeassecP% WEND 'End loop over repeated measurements WEND 'Write the final measurements to the data file CALL rtdat(rtdatP$, i%, tim$, imag!, vmag!, rmag!, t1!, t2!, t3!, t4!, t5!) 'End of measurement loop NEXT i% 'Ramp to 0 amps CALL imagramp(0!) END SUB SUB rtplt (logfile$, cycle%, tim!, imag!, vmag!, rmag!, t1!, t2!, t3!, t4!, t5!) '**************************************************************************** 'This subroutine writes the resistance and temperature measurements 'to the log file. ' 'Inputs: ' logfile$, the name of the log file ' cycle%, the cycle number ' tim!, the time in sec the measurement was taken ' imag!, the magnet current ' vmag!, the magnet voltage ' rmag!, the magnet resistance ' t1!, temperature T1 in deg C ' t2!, temperature T2 in deg C ' t3!, temperature T3 in deg C ' t4!, temperature T4 in deg C ' t5!, temperature T5 in deg C ' 'Zachary Wolf '5/21/95 '**************************************************************************** 'Keep track of Ncall for header STATIC ncall% ncall% = ncall% + 1 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'On the first call, write the header IF ncall% = 1 THEN PRINT #filenum%, ";cycle time Imag Vmag Rmag T1 T2 T3 T4 T5" END IF 'Write the values PRINT #filenum%, USING "###"; cycle%; PRINT #filenum%, USING " #######.#"; tim!; PRINT #filenum%, USING " ####.##"; imag!; PRINT #filenum%, USING " ###.###"; vmag!; PRINT #filenum%, USING " ###.###"; rmag! * 1000!; PRINT #filenum%, USING " ###.##"; t1!; PRINT #filenum%, USING " ###.##"; t2!; PRINT #filenum%, USING " ###.##"; t3!; PRINT #filenum%, USING " ###.##"; t4!; PRINT #filenum%, USING " ###.##"; t5! 'Close the log file CLOSE filenum% END SUB