DECLARE SUB imaggeti (imag!) DECLARE SUB imaglogi (logfile$, imag!) DECLARE SUB imaglogmeas (logfile$, imag!, simag!) DECLARE SUB imaglogramp (logfile$, inom!) DECLARE SUB vaximagramp (imag!) DECLARE SUB vaxstandardize () DECLARE SUB hp3457cv (c%, v!) '**************************************************************************** 'Module IMAG 'This module contains drivers to set and measure the magnet current. ' 'Zachary Wolf '5/31/94 '**************************************************************************** 'Include the parameters used in the module REM $INCLUDE: 'param.inc' SUB imaggeti (imag!) '**************************************************************************** 'This subroutine gets the transductor output voltage. It then applies 'the calibration constant to get the magnet current. ' 'Output: ' imag!, the measured magnet current ' 'Parameters from param.inc: ' imaghpchanP%, the HP3457 channel used to measure transductor voltage ' vtransperimagP!, the conversion factor from magnet current to transductor voltage ' 'Zachary Wolf '4/21/94, 1/5/95 '**************************************************************************** 'Simplify the notation c% = imaghpchanP% vperi! = vtransperimagP! 'Measure the voltage from the transductor CALL hp3457cv(c%, v!) 'Apply the conversion factor imag! = v! / vperi! 'Log the value CALL imaglogi(logfileP$, imag!) END SUB SUB imaglogi (logfile$, imag!) '**************************************************************************** 'This subroutine writes the magnet current to the log file. ' 'Input: ' logfile$, the name of the log file ' imag!, the measured current ' 'Zachary Wolf '9/22/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the results PRINT #filenum%, PRINT #filenum%, TIME$; " Magnet Current, Imag = "; imag!; " A" 'Close the log file CLOSE filenum% END SUB SUB imaglogmeas (logfile$, imag!, simag!) '**************************************************************************** 'This subroutine writes the magnet current to the log file. ' 'Input: ' logfile$, the name of the log file ' imag!, the average measured current ' simag!, the rms variation of imag ' 'Zachary Wolf '1/4/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the results PRINT #filenum%, PRINT #filenum%, TIME$; " Magnet Current Measurement:" PRINT #filenum%, "Imag = "; imag!; " +- "; simag!; " A" 'Close the log file CLOSE filenum% END SUB SUB imaglogramp (logfile$, inom!) '**************************************************************************** 'This subroutine records a magnet current ramp to the log file. ' 'Input: ' logfile$, the name of the log file ' inom!, the desired magnet current ' iinit!, the measured current before the ramp ' ifin!, the measured current after the ramp ' 'Zachary Wolf '1/5/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the results PRINT #filenum%, PRINT #filenum%, TIME$; " Ramping magnet to "; inom!; " A..." 'Close the log file CLOSE filenum% END SUB SUB imagmeas (imag!, simag!) '**************************************************************************** 'This subroutine performs multiple measurements and returns average values 'and rms variations. ' 'Output: ' imag!, the average of the magnet current measurements ' simag!, rms variation of imag ' 'Zachary Wolf '1/3/95 '**************************************************************************** 'Simplify the notation nm% = nmeasaveP% 'Initialize data arrays DIM imeas!(1 TO nm%) 'Loop over the measurements FOR i% = 1 TO nm% 'Measure the magnet current CALL imaggeti(imeas!(i%)) 'End the loop over the measurements NEXT i% 'Compute average imag! = 0! FOR i% = 1 TO nm% imag! = imag! + imeas!(i%) NEXT i% imag! = imag! / nm% 'Compute rms deviations simag! = 0! FOR i% = 1 TO nm% simag! = simag! + (imeas!(i%) - imag!) ^ 2 NEXT i% simag! = SQR(simag! / nm%) 'Print the results to the screen PRINT PRINT "Magnet Current:" PRINT "Imag = "; imag!; " +- "; simag!; " A" 'Write these results to the log file CALL imaglogmeas(logfileP$, imag!, simag!) END SUB SUB imagramp (inom!) '**************************************************************************** 'This subroutine calls the routines which ramp the current through the VAX. ' 'Input: ' inom!, the desired magnet current ' 'Zachary Wolf '1/1/95 '**************************************************************************** 'Make an initial measurement of the magnet current 'Value stored in the log file CALL imaggeti(iinit!) 'Record the ramp in the log file CALL imaglogramp(logfileP$, inom!) 'Ramp to imag from the VAX CALL vaximagramp(inom!) 'Measure the magnet current after the ramp for the log file CALL imaggeti(ifin!) END SUB SUB imagstandardize '**************************************************************************** 'This subroutine calls the VAX standardization routine. ' 'Zachary Wolf '1/1/95 '**************************************************************************** 'Standardize from the VAX CALL vaxstandardize END SUB