DECLARE SUB hp3457startcntv (c%, n%, t!) DECLARE SUB hp3457getcntv (n%, v!()) DECLARE SUB wiregetvt (x0!, dx!, vt!) DECLARE SUB wirelogmoveabs (logfile$, x!) DECLARE SUB wirelogmoverel (logfile$, dx!) DECLARE SUB wirelogplotv (logfile$, ns%, t!(), v!()) DECLARE SUB wirelogvt (logfile$, x0!, dx!, vt!) DECLARE SUB wirelogvtav (logfile$, x0!, dx!, nm%, vt!, svt!) DECLARE SUB wiremoveabs (x!) DECLARE SUB wiremoverel (dx!) DECLARE SUB wiretrapint (ns%, y!(), dx!, iydx!) DECLARE SUB mc4moveabs (x!) DECLARE SUB mc4moverel (dx!) DECLARE SUB hp3458getntv (n%, v!()) DECLARE SUB hp3458startntv (n%, t!) '**************************************************************************** 'Module WIRE 'This module contains routines to perform stretched wire measurements. ' 'Zachary Wolf '5/31/94 '**************************************************************************** 'Include the parameters used in the module REM $INCLUDE: 'param.inc' SUB wiregetvt (x0!, dx!, vt!) '**************************************************************************** 'This subroutine moves the wire and finds the integrated voltage from 'the wire. ' 'Input: ' x0!, nominal center position about which the wire moves ' dx!, nominal distance the wire moves, sign gives direction ' 'Output: ' vt!, integrated voltage from the wire ' 'Zachary Wolf '1/14/95 '**************************************************************************** 'Simplify the notation ns% = nsampleP% vel! = velcmsP! tsampbef! = tsamplebefsP! tsampaft! = tsampleaftsP! 'Initialize data arrays DIM v!(0 TO ns% - 1) 'voltage samples from the wire 'Compute how long the DVM should sample and the time between samples tsamp! = tsampbef! + (ABS(dx!) / vel!) + tsampaft! dt! = tsamp! / ns% 'Move to the starting point CALL wiremoveabs(x0! - (dx! / 2)) 'Start the DVM sampling the wire voltage 'PRINT "ns% = "; ns%; ", dt! = ", dt! CALL hp3458startntv(ns%, dt!) 'CALL hp3457startcntv(vwirehpchanP%, ns%, dt!) 'Sample before the wire motion t0! = TIMER WHILE TIMER - t0! < tsampbef! WEND 'Move the wire to the final position CALL wiremoverel(dx!) 'Sample after the wire motion allowing the wire to settle t0! = TIMER WHILE TIMER - t0! < tsampaft! WEND 'Get the voltage samples CALL hp3458getntv(ns%, v!()) 'CALL hp3457getcntv(ns%, v!()) 'Compute the integrated voltage CALL wiretrapint(ns%, v!(), dt!, vt!) 'Log the result CALL wirelogvt(logfileP$, x0!, dx!, vt!) END SUB SUB wiregetvtav (x0!, dx!, vt!, svt!) '**************************************************************************** 'This subroutine moves the wire and finds the integrated voltage from 'the wire. ' 'Input: ' x0!, nominal center position about which the wire moves ' dx!, nominal distance the wire moves ' 'Output: ' vt!, integrated voltage from the wire ' svt!, standard deviation of vt ' 'Zachary Wolf '1/14/95 '**************************************************************************** 'Simplify the notation nm% = nmeasaveP% 'Initialize data arrays DIM vtmeas!(1 TO nm%) 'voltage integral = flux crossed 'Loop over measurements for averaging FOR j% = 1 TO nm% 'Get the integrated voltage for a + move CALL wiregetvt(x0!, dx!, vtp!) 'Get the integrated voltage for a - move CALL wiregetvt(x0!, -dx!, vtm!) 'Compute the average integrated voltage for this measurement vtmeas!(j%) = (vtp! - vtm!) / 2! 'End averaging loop NEXT j% 'Compute the average of the measurements vt! = 0! FOR j% = 1 TO nm% vt! = vt! + vtmeas!(j%) NEXT j% vt! = vt! / nm% 'Compute the standard deviation of the measurements svt! = 0! FOR j% = 1 TO nm% svt! = svt! + (vtmeas!(j%) - vt!) ^ 2 NEXT j% svt! = SQR(svt! / nm%) 'Message PRINT PRINT "Integrated Voltage From The Wire:" PRINT "X0 = "; x0!; " cm, Delta X = "; dx!; " cm" PRINT "Integrated Voltage = "; vt!; " +- "; svt!; " VS (= Tm^2)" 'Write the result to the log file CALL wirelogvtav(logfileP$, x0!, dx!, nm%, vt!, svt!) END SUB SUB wirelogmoveabs (logfile$, x!) '**************************************************************************** 'This subroutine logs wire movements to the log file. ' 'Input: ' logfile$, the name of the log file ' x!, the position the wire is moved to ' 'Zachary Wolf '11/23/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the results PRINT #filenum%, PRINT #filenum%, TIME$; " Wire moved to X = "; x!; " cm" 'Close the log file CLOSE filenum% END SUB SUB wirelogmoverel (logfile$, dx!) '**************************************************************************** 'This subroutine logs wire movements to the log file. ' 'Input: ' logfile$, the name of the log file ' dx!, the distance the wire is moved ' 'Zachary Wolf '1/22/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the results PRINT #filenum%, PRINT #filenum%, TIME$; " Wire moved by DX = "; dx!; " cm" 'Close the log file CLOSE filenum% END SUB SUB wirelogplotv (logfile$, ns%, t!(), v!()) '**************************************************************************** 'This subroutine writes voltage samples to the log file. ' 'Inputs: ' logfile$, the name of the log file ' ns%, the number of voltage samples ' t!(0 to ns%-1), the time of each voltage sample ' v!(0 to ns%-1), the voltage samples ' 'Zachary Wolf '1/7/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Write the samples to the log file FOR k% = 0 TO ns% - 1 PRINT #filenum%, USING "#####"; k%; PRINT #filenum%, USING " ###.########"; t!(k%); PRINT #filenum%, USING " ###.########"; v!(k%) NEXT k% 'Close the log file CLOSE filenum% END SUB SUB wirelogvt (logfile$, x0!, dx!, vt!) '**************************************************************************** 'This subroutine writes integrated voltage measurements to the log file. ' 'Input: ' logfile$, the name of the log file ' x0!, the position about which the wire motion is centered ' dx!, the distance the wire is moved ' vt!, the measured integrated voltage ' 'Zachary Wolf '11/23/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the results PRINT #filenum%, PRINT #filenum%, TIME$; " X0 = "; x0!; " cm, dx = "; dx!; " cm, VT = "; vt!; " VS" 'Close the log file CLOSE filenum% END SUB SUB wirelogvtav (logfile$, x0!, dx!, nm%, vt!, svt!) '**************************************************************************** 'This subroutine write a summary of a stretched wire measurement to the 'log file. ' 'Input: ' logfile$, the name of the log file ' x0!, the center of the wire motion ' dx!, the distance the wire was moved ' nm%, the number of measurements for the average ' vt!, the integrated voltage from the wire ' svt!, the standard deviation of vt ' 'Zachary Wolf '11/25/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print the results PRINT #filenum%, PRINT #filenum%, TIME$; " Integrated Voltage Measurement:" PRINT #filenum%, "Center Of Wire Motion, X0 = "; x0!; " cm" PRINT #filenum%, "Distance Wire Moved, Delta X = "; dx!; " cm" PRINT #filenum%, "# Measurements For Average, Nmeas = "; nm% PRINT #filenum%, "Integrated Voltage, VT = "; vt!; " +- "; svt!; " VS (= Tm^2)" 'Close the log file CLOSE filenum% END SUB SUB wiremoveabs (x!) '**************************************************************************** 'This subroutine controls the wire motion. ' 'Input: ' x!, the x position to move to ' 'Zachary Wolf '1/14/95 '**************************************************************************** 'Move the wire CALL mc4moveabs(x!) 'Log the move CALL wirelogmoveabs(logfileP$, x!) END SUB SUB wiremoverel (dx!) '**************************************************************************** 'This subroutine controls the wire motion by an amount relative to the 'present position. ' 'Input: ' dx!, the distance to move in cm, the sign gives the direction ' 'Zachary Wolf '1/22/95 '**************************************************************************** 'Move the wire CALL mc4moverel(dx!) 'Log the move CALL wirelogmoverel(logfileP$, dx!) END SUB SUB wireplotv (x0!, dx!) '**************************************************************************** 'This subroutine moves the wire and finds the integrated voltage from 'the wire. ' 'Input: ' x0!, nominal center position about which the wire moves ' dx!, nominal distance the wire moves, sign gives direction ' 'Zachary Wolf '1/14/95 '**************************************************************************** 'Simplify the notation ns% = nsampleP% 'Initialize data arrays DIM v!(0 TO ns% - 1) 'voltage samples from the wire DIM t!(0 TO ns% - 1) 'time of each voltage sample 'Compute how long the DVM should sample and the time between samples tsamp! = tsamplebefsP! + ABS(dx!) / velcmsP! + tsampleaftsP! dt! = tsamp! / ns% 'Message PRINT "Measuring the wire voltage..." 'Move to the starting point CALL wiremoveabs(x0! - (dx! / 2)) 'Start the DVM sampling the wire voltage CALL hp3458startntv(ns%, dt!) 'CALL hp3457startcntv(vwirehpchanP%, ns%, dt!) 'Sample before the wire motion t0! = TIMER WHILE TIMER - t0! < tsamplebefsP! WEND 'Move the wire to the final position CALL wiremoverel(dx!) 'Sample after the wire motion allowing the wire to settle t0! = TIMER WHILE TIMER - t0! < tsampleaftsP! WEND 'Get the voltage samples CALL hp3458getntv(ns%, v!()) 'CALL hp3457getcntv(ns%, v!()) 'Compute the time of each sample FOR i% = 0 TO ns% - 1 t!(i%) = i% * dt! NEXT i% 'Initialize a plot file pltfilewireP$ = "vwireplt.dat" filenum% = FREEFILE OPEN pltfilewireP$ FOR OUTPUT AS filenum% CLOSE filenum% 'Plot the results CALL wirelogplotv(pltfilewireP$, ns%, t!(), v!()) END SUB SUB wiretrapint (ns%, y!(), dx!, iydx!) '**************************************************************************** 'This subroutine uses the trapezoidal rule to perform a numerical 'integration. ' 'Input: ' ns%, the number of steps for the integration ' y!(0 to ns%-1), the y values ' dx!, the spacing between y values ' 'Output: ' iydx!, the value of the integral ' 'Zachary Wolf '7/7/94, 12/27/94 '**************************************************************************** 'Initialize iydx! = 0 'Sum the areas of the trapezoids to get the integral FOR i% = 1 TO ns% - 1 iydx! = iydx! + .5 * (y!(i%) + y!(i% - 1)) * dx! NEXT i% END SUB