DECLARE SUB pshp3457cv (c%, v!) DECLARE SUB vtwmoveabs (x!) DECLARE SUB vtwplotv (x0!, dx!) DECLARE SUB fileinitlog (logfile$) DECLARE SUB psdac488init (gpibin%, gpibout%, psdac488addr$) DECLARE SUB pshp3457init (gpibin%, gpibout%, pshp3457addr$) DECLARE SUB imagexit () DECLARE SUB imaginit () DECLARE SUB ips123setpar (logfile$, imagconfig$, ips1hpchan%, ips2hpchan%, ips3hpchan%, ips1dacchan%, ips2dacchan%, ips3dacchan%, vtransperimag!, imagpervdac!, imagtstable%) DECLARE SUB dwblvsi () DECLARE SUB qwglvsi () DECLARE SUB swslvsi () DECLARE SUB qwsetpar (logfile$, datfile$, pltfile$, magname$, run$, dxcm!, nx0%, x0!(), nturns%, nimagtest%, imagtest!()) DECLARE SUB swsetpar (logfile$, datfile$, pltfile$, magname$, run$, dxcm!, nx0%, x0!(), nturns%, nimagtest%, imagtest!()) DECLARE SUB vtwsetpar (logfile$, velcms!, tsamplebefs!, tsampleafts!, nsample%, nmeasave%) DECLARE SUB imagramp (inom!) DECLARE SUB imagsetpar (logfile$, imagconfig$, imagramprate!, imagnmeasave%, imaglimit!) DECLARE SUB imagstandardize (nstand%, istand!) DECLARE SUB ibopinit () DECLARE SUB ibopsetpar (imaghpchan%, vtransperimag!, imagtstable%) DECLARE SUB fileinitwire (project$, magname$, run$, logfile$, datfile$, pltfile$, ok$) DECLARE SUB gettestparam (magnameP$, barcodeP$, projectP$, teststandP$, coilnameP$, operatorP$, runP$, commentP$) DECLARE SUB fileistand (logfile$, n%, istand!) DECLARE SUB fileitest (logfile$, n%, imag!()) DECLARE SUB imagsaturate (isat!) DECLARE SUB fileheader (logfile$, magname$, barcode$, project$, teststand$, coilname$, operator$, run$, comment$) DECLARE SUB fileisat (logfile$, isat!) DECLARE SUB wireexit () DECLARE SUB wireinit () DECLARE SUB wiremeas () DECLARE SUB gpibinit (gpibin%, gpibout%) DECLARE SUB bit488init (gpibin%, gpibout%, bit488addr$) DECLARE SUB hp3457init (gpibin%, gpibout%, hp3457addr$) DECLARE SUB mc4init (gpibin%, gpibout%, mc4addr$) DECLARE SUB mc4zero () DECLARE SUB mc4setpar (velcmsP!, acctimeP!, x1P$, x2P$) DECLARE SUB hp3458init (gpibin%, gpibout%, hp3458addr$) DECLARE SUB dwblvsx () DECLARE SUB dwsetpar (logfile$, datfile$, pltfile$, magname$, run$, dxcm!, nx0%, x0!(), nturns%, nimagtest%, imagtest!()) '**************************************************************************** 'Program WIRE 'This program is used to make stretched wire measurements in dipoles, 'quadrupoles, and sextupoles. ' 'Zachary Wolf '3/8/95 '**************************************************************************** COMMON SHARED /test/ gpibinP%, gpiboutP% 'Include the constants used in the program 'Execute assignment statements REM $INCLUDE: 'param.inc' 'Prepare the screen CLS 'Print a message about the program PRINT PRINT "Program WIRE" PRINT "This program performs wire scan measurements in dipoles," PRINT "quadrupoles, and sextupoles." PRINT "It does this by finding the magnetic flux in the area enclosed" PRINT "by the wire's initial and final positions. The flux divided by" PRINT "the distance the wire moves gives the integrated field strength." PRINT "Scans across the magnet give the integrated quadrupole and" PRINT "sextupole strengths." 'Initialize the software and hardware CALL wireinit 'Perform the stretched wire measurement 'CALL wiremeas 'Set the acceleration 'PRINT #gpiboutP%, "TERM IN CR LF" 'PRINT #gpiboutP%, "TERM OUT CR LF" 'PRINT #gpiboutP%, "OUTPUT " + mc4addrP$ + ";ACA"; 'PRINT #gpiboutP%, USING "#.#"; acctimeP! 'PRINT #gpiboutP%, "OUTPUT " + mc4addrP$ + ";RA400" 'PRINT #gpiboutP%, "OUTPUT " + mc4addrP$ + ";ACA1.7"; 'PRINT #gpiboutP%, "OUTPUT " + mc4addrP$ + ";RA400" 'PRINT #gpiboutP%, "ENTER " + mc4addrP$ 'INPUT #gpibinP%, er$ 'PRINT er$ 'STOP 'FOR i% = 1 TO 5 ' PRINT i%; ' i! = i% ' IF i% = 5 THEN CALL imagramp(i!) ' IF i% = 7 THEN CALL vtwmoveabs(0!) ' IF i% = 3 THEN CALL vtwplotv(0!, 1!) ' CALL pshp3457cv(1!, v!) ' PRINT " v = "; v! 'NEXT i% 'CALL vtwmoveabs(0!) 'STOP CALL imagramp(50!) CALL mc4zero CALL vtwplotv(0!, 1!) CALL vtwmoveabs(0!) 'CALL imagramp(100!) 'CALL vtwplotv(0!, 1!) 'CALL vtwmoveabs(0!) 'Prepare to exit the program CALL wireexit 'Message PRINT "The measurement is complete." END SUB wireexit '**************************************************************************** 'This subroutine prepares for the program to exit. ' 'Zachary Wolf '9/21/95 '**************************************************************************** 'Prepare the power system to be turned off CALL imagexit END SUB SUB wireinit '**************************************************************************** 'This subroutine does all the initialization for the program. 'Most parameters come from param.inc. ' 'Zachary Wolf '9/20/95 '**************************************************************************** 'Initialize the hardware 'Initialize the GPIB CALL gpibinit(gpibinP%, gpiboutP%) 'Initialize the HP3457 PRINT PRINT "Took out HP3457 init" 'CALL hp3457init(gpibinP%, gpiboutP%, hp3457addrP$) 'Initialize the HP3458 CALL hp3458init(gpibinP%, gpiboutP%, hp3458addrP$) 'Initialize the MC4 CALL mc4init(gpibinP%, gpiboutP%, mc4addrP$) CALL mc4setpar(velcmsP!, acctimeP!, x1P$, x2P$) 'Initialize the Kepco power supply IF imagconfigP$ = "KEPCO" THEN CALL bit488init(gpibinP%, gpiboutP%, bit488addrP$) END IF 'Initialize the PSDAC488 IF imagconfigP$ = "1" OR imagconfigP$ = "2" OR imagconfigP$ = "3" OR imagconfigP$ = "12S" OR imagconfigP$ = "12P" OR imagconfigP$ = "123P" THEN CALL psdac488init(gpibinP%, gpiboutP%, psdac488addrP$) END IF 'Initialize the PSHP3457 IF imagconfigP$ = "1" OR imagconfigP$ = "2" OR imagconfigP$ = "3" OR imagconfigP$ = "12S" OR imagconfigP$ = "12P" OR imagconfigP$ = "123P" THEN CALL pshp3457init(gpibinP%, gpiboutP%, pshp3457addrP$) END IF 'Initialize the software 'Get test parameters from the operator 'testparam: 'CALL gettestparam(magnameP$, barcodeP$, projectP$, teststandP$, coilnameP$, operatorP$, runP$, commentP$) 'Open all files 'CALL fileinitwire(projectP$, magnameP$, runP$, logfileP$, datfileP$, pltfileP$, ok$) 'IF ok$ <> "y" THEN ' PRINT : PRINT "Problem opening the data files. Try a different run number.": PRINT ' GOTO testparam: 'END IF CALL fileinitlog(logfileP$) 'Write general headers to the log and dat files CALL fileheader(logfileP$, magnameP$, barcodeP$, projectP$, teststandP$, coilnameP$, operatorP$, runP$, commentP$) 'CALL fileheader(datfileP$, magnameP$, barcodeP$, projectP$, teststandP$, coilnameP$, operatorP$, runP$, commentP$) 'Write headers describing the initial iron saturation IF imagsaturateP! > 0 THEN CALL fileisat(logfileP$, imagsaturateP!) ' CALL fileisat(datfileP$, imagsaturateP!) END IF 'Write headers describing the standardization IF nstandcycleP% > 0 THEN CALL fileistand(logfileP$, nstandcycleP%, imagstandP!) ' CALL fileistand(datfileP$, nstandcycleP%, imagstandP!) END IF 'Write headers describing the test currents IF measurementP$ <> "BLVSX" AND nimagtestP% > 0 THEN CALL fileitest(logfileP$, nimagtestP%, imagtestP!()) ' CALL fileitest(datfileP$, nimagtestP%, imagtestP!()) END IF 'Set the parameters in the dipole wire measurement routines CALL dwsetpar(logfileP$, datfileP$, pltfileP$, magnameP$, runP$, dxcmP!, nx0P%, x0P!(), nturnsP%, nimagtestP%, imagtestP!()) 'Set the parameters in the quadrupole wire measurement routines CALL qwsetpar(logfileP$, datfileP$, pltfileP$, magnameP$, runP$, dxcmP!, nx0P%, x0P!(), nturnsP%, nimagtestP%, imagtestP!()) 'Set the parameters in the sextupole wire measurement routines CALL swsetpar(logfileP$, datfileP$, pltfileP$, magnameP$, runP$, dxcmP!, nx0P%, x0P!(), nturnsP%, nimagtestP%, imagtestP!()) 'Set the parameters for the wire motion routines CALL vtwsetpar(logfileP$, velcmsP!, tsamplebefsP!, tsampleaftsP!, nsampleP%, nmeasaveP%) 'Set the parameters for the Kepco power supply control CALL ibopsetpar(imaghpchanP%, vtransperimagP!, imagtstableP%) 'Set the parameters for the PS123 power system CALL ips123setpar(logfileP$, imagconfigP$, ips1hpchanP%, ips2hpchanP%, ips3hpchanP%, ips1dacchanP%, ips2dacchanP%, ips3dacchanP%, vtransperimagP!, imagpervdacP!, imagtstableP%) 'Set the parameters for the IMAG routines CALL imagsetpar(logfileP$, imagconfigP$, imagramprateP!, imagnmeasaveP%, imaglimitP!) 'Initialize the power sypply CALL imaginit END SUB SUB wiremeas '**************************************************************************** 'This subroutine supervises the stretched wire measurements. ' 'Zachary Wolf '9/21/95 '**************************************************************************** 'Starting Position PRINT PRINT "Starting Position" PRINT "Please move the wire as close to the center of the magnet as possible." PRINT "The exact location is not critical." PRINT "This position will be the (0,0) position." INPUT "Press ENTER when ready. ", a$ CALL mc4zero 'Saturate the magnet steel IF imagsaturateP! > 0 THEN CALL imagsaturate(imagsaturateP!) END IF 'Standardize the magnet IF nstandcycleP% > 0 THEN CALL imagstandardize(nstandcycleP%, imagstandP!) END IF 'Perform the measurements IF measurementP$ = "BLVSX" THEN CALL dwblvsx ELSEIF measurementP$ = "BLVSI" THEN CALL dwblvsi ELSEIF measurementP$ = "GLVSI" THEN CALL qwglvsi ELSEIF measurementP$ = "SLVSI" THEN CALL swslvsi ELSE PRINT "WIRE: Unknown measurement requested, exiting" END IF END SUB