DECLARE SUB imaggeti (imag!) DECLARE SUB imagramp (inom!) DECLARE SUB dac488hrinit () DECLARE SUB imansetpar (imaghpchan%, vtransperimag!) DECLARE SUB dac488init () DECLARE SUB dac488setpar (gpibin%, gpibout%, dac488addr$) DECLARE SUB dac488hrsetpar (gpibin%, gpibout%, dac488hraddr$) DECLARE SUB idacsetpar (imagdacchan%, imagpervdac!, imagtstable%, imaghpchan%, vtransperimag!) DECLARE SUB idachrsetpar (imagdacchan%, imagpervdac!, imagtstable%, imaghpchan%, vtransperimag!) DECLARE SUB spolsetpar (logfile$, strdatfile$, strpltfile$, hardatfile$, harpltfile$, magname$, run$, strcoilid%, strspolcoilconst!, harcoilradiusm!, blnmeasave%, nimagtest%, imagtest!(), imagharflag!(), nhardisplay%) DECLARE SUB dpolmain () DECLARE SUB dpolsetpar (logfile$, strdatfile$, strpltfile$, hardatfile$, harpltfile$, magname$, run$, strcoilid%, strdpolcoilconst!, harcoilradiusm!, blnmeasave%, nimagtest%, imagtest!(), imagharflag!(), nhardisplay%) DECLARE SUB fileblankline (logfile$) DECLARE SUB coilinit () DECLARE SUB coilmeas () DECLARE SUB coilexit () DECLARE SUB gpibinit (gpibin%, gpibout%) DECLARE SUB bit488setpar (gpibin%, gpibout%, bit488addr$) DECLARE SUB psdac488setpar (gpibin%, gpibout%, psdac488addr$) DECLARE SUB pshp3457setpar (gpibin%, gpibout%, pshp3457addr$) DECLARE SUB hp3457init () DECLARE SUB hp3457setpar (gpibin%, gpibout%, hp3457addr$) DECLARE SUB vcoilsetpar (logfile$, coilnsampperrev%, coilnrevpermeas%, coilfreqhpchan%, strcoilhpchan%, harcoilhpchan%, strcoilid%, harcoilid%) DECLARE SUB blsetpar (logfile$, magname$, run$, harcoilid%, harcoilradiusm!, harcoilnturns%, blnmeasave%) DECLARE SUB qpolmain () DECLARE SUB qpolsetpar (logfile$, strdatfile$, strpltfile$, hardatfile$, harpltfile$, magname$, run$, strcoilid%, strqpolcoilconst!, harcoilradiusm!, blnmeasave%, nimagtest%, imagtest!(), imagharflag!(), nhardisplay%) DECLARE SUB spolmain () DECLARE SUB imagexit () DECLARE SUB imaginit () DECLARE SUB imagsaturate (isat!) DECLARE SUB imagsetpar (logfile$, imagconfig$, imagramprate!, imagnmeasave%, imaglimit!) DECLARE SUB imagstandardize (nstand%, istand!) DECLARE SUB ibopsetpar (imaghpchan%, vtransperimag!, imagtstable%) DECLARE SUB ips123setpar (logfile$, imagconfig$, imagtstable%) DECLARE SUB fileheader (logfile$, project$, magtype$, magname$, barcode$, teststand$, coilname$, operator$, run$, comment$) DECLARE SUB fileinitcoil (project$, magtype$, magname$, run$, logfile$, strdatfile$, hardatfile$, strpltfile$, harpltfile$, ok$) DECLARE SUB fileisat (logfile$, isat!) DECLARE SUB fileistand (logfile$, n%, istand!) DECLARE SUB fileitest (logfile$, n%, imag!()) DECLARE SUB gettestparam (projectP$, magtypeP$, magnameP$, barcodeP$, teststandP$, coilnameP$, operatorP$, runP$, commentP$) '**************************************************************************** 'Program COIL 'This program is used to make rotating coil measurements in dipoles, 'quadrupoles, and sextupoles. ' 'Zachary Wolf '11/20/95 '**************************************************************************** 'Common area for run time parameters COMMON SHARED /gpibio/ gpibinP%, gpiboutP% COMMON SHARED /filenames/ logfileP$, strdatfileP$, hardatfileP$, strpltfileP$, harpltfileP$ COMMON SHARED /testinfo/ projectP$, magtypeP$, magnameP$, barcodeP$, teststandP$, coilnameP$, operatorP$, runP$, commentP$ '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 COIL" PRINT "This program performs rotating coil measurements in dipoles," PRINT "quadrupoles, and sextupoles." PRINT "These measurements give magnet strengths and harmonics." 'Initialize the software and hardware CALL coilinit 'Check the power supply CALL imagramp(10!) CALL imaggeti(imag!) PRINT "Imag = "; imag!; " A" CALL imagramp(0!) STOP 'Perform the rotating coil measurement 'CALL coilmeas 'Prepare to exit the program CALL coilexit 'Message PRINT "The measurement is complete." END SUB coilexit '**************************************************************************** '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 coilinit '**************************************************************************** 'This subroutine does all the initialization for the program. 'Most parameters come from param.inc. ' 'Zachary Wolf '9/20/95 '**************************************************************************** 'Hardware init 'Initialize the GPIB CALL gpibinit(gpibinP%, gpiboutP%) 'Set the parameters for the HP3457 CALL hp3457setpar(gpibinP%, gpiboutP%, hp3457addrP$) CALL hp3457init 'Set the parameters for the DAC488 (used for PS and the Reset signal) CALL dac488setpar(gpibinP%, gpiboutP%, dac488addrP$) 'Set the parameters for the DAC488HR CALL dac488hrsetpar(gpibinP%, gpiboutP%, dac488hraddrP$) CALL dac488hrinit 'Set the parameters for the Kepco supply CALL bit488setpar(gpibinP%, gpiboutP%, bit488addrP$) 'Set the parameters for the PS123 DAC488 CALL psdac488setpar(gpibinP%, gpiboutP%, psdac488addrP$) 'Set the parameters for the PS123 HP3457 CALL pshp3457setpar(gpibinP%, gpiboutP%, pshp3457addrP$) 'Software init 'Get test parameters from the operator testparam: 'CALL gettestparam(projectP$, magtypeP$, magnameP$, barcodeP$, teststandP$, coilnameP$, operatorP$, runP$, commentP$) 'Open all files 'CALL fileinitcoil(projectP$, magtypeP$, magnameP$, runP$, logfileP$, strdatfileP$, hardatfileP$, strpltfileP$, harpltfileP$, ok$) 'IF ok$ <> "y" THEN ' PRINT : PRINT "Problem opening the data files. Try a different run number.": PRINT ' GOTO testparam: 'END IF filenum% = FREEFILE logfileP$ = "logfile.dat" OPEN logfileP$ FOR OUTPUT AS filenum% CLOSE filenum% 'Set parameters for the main magnet measurements modules CALL dpolsetpar(logfileP$, strdatfileP$, strpltfileP$, hardatfileP$, harpltfileP$, magnameP$, runP$, strcoilidP%, strdpolcoilconstP!, harcoilradiusmP!, blnmeasaveP%, nimagtestP%, imagtestP!(), imagharflagP!(), nhardisplayP%) CALL qpolsetpar(logfileP$, strdatfileP$, strpltfileP$, hardatfileP$, harpltfileP$, magnameP$, runP$, strcoilidP%, strqpolcoilconstP!, harcoilradiusmP!, blnmeasaveP%, nimagtestP%, imagtestP!(), imagharflagP!(), nhardisplayP%) CALL spolsetpar(logfileP$, strdatfileP$, strpltfileP$, hardatfileP$, harpltfileP$, magnameP$, runP$, strcoilidP%, strspolcoilconstP!, harcoilradiusmP!, blnmeasaveP%, nimagtestP%, imagtestP!(), imagharflagP!(), nhardisplayP%) 'Set parameters for the harmonics measurements, common to all magnet types CALL blsetpar(logfileP$, magnameP$, runP$, harcoilidP%, harcoilradiusmP!, harcoilnturnsP%, blnmeasaveP%) 'Set parameters for the coil voltage measurements CALL vcoilsetpar(logfileP$, coilnsampperrevP%, coilnrevpermeasP%, coilfreqhpchanP%, strcoilhpchanP%, harcoilhpchanP%, strcoilidP%, harcoilidP%) 'Set the parameters for the magnet current control CALL imagsetpar(logfileP$, imagconfigP$, imagramprateP!, imagnmeasaveP%, imaglimitP!) 'Set the parameters for the Kepco power supply control CALL ibopsetpar(imaghpchanP%, vtransperimagP!, imagtstableP%) 'Set the parameters for DAC488 power supply control CALL idacsetpar(imagdacchanP%, imagpervdacP!, imagtstableP%, imaghpchanP%, vtransperimagP!) 'Set the parameters for DAC488HR power supply control CALL idachrsetpar(imagdacchanP%, imagpervdacP!, imagtstableP%, imaghpchanP%, vtransperimagP!) 'Set the parameters for the PS123 power system CALL ips123setpar(logfileP$, imagconfigP$, imagtstableP%) 'Set the parameters for manual power system operation CALL imansetpar(imaghpchanP%, vtransperimagP!) 'Write general headers to the log and dat files 'CALL fileheader(logfileP$, projectP$, magtypeP$, magnameP$, barcodeP$, teststandP$, coilnameP$, operatorP$, runP$, commentP$) 'CALL fileheader(strdatfileP$, projectP$, magtypeP$, magnameP$, barcodeP$, teststandP$, coilnameP$, operatorP$, runP$, commentP$) 'CALL fileheader(hardatfileP$, projectP$, magtypeP$, magnameP$, barcodeP$, teststandP$, coilnameP$, operatorP$, runP$, commentP$) 'Write headers describing the initial iron saturation 'IF imagsaturateP! > 0 THEN ' CALL fileisat(logfileP$, imagsaturateP!) ' CALL fileisat(strdatfileP$, imagsaturateP!) ' CALL fileisat(hardatfileP$, imagsaturateP!) 'END IF 'Write headers describing the standardization 'IF nstandcycleP% > 0 THEN ' CALL fileistand(logfileP$, nstandcycleP%, imagstandP!) ' CALL fileistand(strdatfileP$, nstandcycleP%, imagstandP!) ' CALL fileistand(hardatfileP$, nstandcycleP%, imagstandP!) 'END IF 'Write headers describing the test currents 'CALL fileitest(logfileP$, nimagtestP%, imagtestP!()) 'CALL fileitest(strdatfileP$, nimagtestP%, imagtestP!()) 'CALL fileitest(hardatfileP$, nimagtestP%, imagtestP!()) 'Initialize the power sypply system CALL imaginit END SUB SUB coilmeas '**************************************************************************** 'This subroutine supervises the rotating coil measurements. ' 'Zachary Wolf '9/21/95 '**************************************************************************** '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$ = "BLVSI" THEN CALL dpolmain ELSEIF measurementP$ = "GLVSI" THEN CALL qpolmain ELSEIF measurementP$ = "SLVSI" THEN CALL spolmain ELSE PRINT PRINT "Unknown measurement requested." END IF END SUB