DECLARE SUB fileheader () DECLARE SUB fileopen (path$, run$) DECLARE SUB gettestparam () DECLARE SUB measure (coil%) DECLARE SUB logheader (logfile$, mn$, op$, ts$, dv$, rn$, cm$) DECLARE SUB logopen (logfile$) DECLARE SUB logsumm (logfile$, c%, i!, vt!, svt!) DECLARE SUB logvt (logfile$, m%, i1!, i2!, nave%, vtp!(), vtn!()) DECLARE SUB imagmeas (c%, vperi!, imag!) DECLARE SUB imagramp (rr!, iperv!, ifin!) DECLARE SUB vcoilcntvt (c%, n%, t!, nave%, vtp!(), vtn!(), vt!, sigvt!) DECLARE SUB gpibinit () DECLARE SUB dac488hrinit () DECLARE SUB dac488hrsetupv () DECLARE SUB hp3457init () '**************************************************************************** 'Program HERDTEST 'This program is used to quickly test various aspects of the HER dipole 'measurements and measurement system. ' 'Zachary Wolf '5/15/94 '**************************************************************************** 'Include the constants used in the program REM $INCLUDE: 'param.inc' 'Prepare the screen CLS 'Initialize the GPIB CALL gpibinit 'Initialize the DAC CALL dac488hrinit CALL dac488hrsetupv 'Initialize the HP3457 CALL hp3457init 'Print a message about the program PRINT PRINT "Program HERDTEST" PRINT "This program is used to quickly test various aspects of the HER" PRINT "measurements and measurement system." PRINT 'Get test parameters from the operator CALL gettestparam 'Open the log and data files and write headers path$ = "" CALL fileopen(path$, runP$) CALL fileheader 'Prompt the operator for a task q: PRINT PRINT "Do you wish to" PRINT "[R]amp the magnet." PRINT "[M]easure the integrated voltage from a coil." PRINT "[E]nd the test." INPUT t$ t$ = UCASE$(MID$(t$, 1, 1)) PRINT 'Ramp IF t$ = "R" THEN qi: INPUT "What current do you wish to ramp to? (amps) ", curr! IF curr! < 0 OR curr! > 800! THEN PRINT "The current must be between 0 2 THEN PRINT "The coil numbers are 0, 1, and 2." GOTO qm: END IF CALL measure(c%) END IF 'End IF t$ <> "E" THEN GOTO q: 'Message PRINT PRINT "Ramping to 0 Amps." 'Ramp to 0 amps CALL imagramp(imagramprateP!, imagpervdacP!, 0!) 'Message PRINT "The test is finished." END SUB fileheader '**************************************************************************** 'This subroutine writes the headers of the files. ' 'Input from the /testparam/ common block: ' magnameP$, magnet name ' teststandP$, the teststand ' operatorP$, operator name ' runP$, the run number ' commentP$, a comment about the test ' 'Input from the /filenames/ common block: ' logfileP$, the log file ' 'Zachary Wolf '4/16/94 '**************************************************************************** 'Write the header of the log file CALL logheader(logfileP$, magnameP$, operatorP$, "D0, D1, or D2", "PEP Coils 0, 1, and 2", runP$, commentP$) END SUB SUB fileopen (path$, run$) '**************************************************************************** 'This subroutine opens the files that the program uses. ' 'Input: ' path$, subdirectory where the files are to be created ' run$, run number, used to distinguish files ' 'Output placed in the /filenames/ common block: ' logfileP$, name, including the path, of the log file ' 'Zachary Wolf '4/16/94 '**************************************************************************** 'Make the file extension r% = VAL(run$) IF r% < 10 THEN ext$ = "ru" + run$ IF r% >= 10 THEN ext$ = "r" + run$ 'Open the log file logfile$ = "testlog." + ext$ CALL logopen(logfile$) PRINT logfile$; " created" 'Store the file name logfileP$ = logfile$ END SUB SUB gettestparam '**************************************************************************** 'This subroutine prompts the operator for the magnet name and other 'parameters of the test. ' 'Outputs put in the /testparam/ common block: ' magnameP$, name of magnet 1 ' operatorP$, name of the operator doing the test ' runP$, run number ' commentP$, comment about the test ' 'Zachary Wolf '4/16/94 '**************************************************************************** begin: 'Get the name of the magnet PRINT "What is the name of the magnet being used for this test?" PRINT "(8 characters or less): ["; magnameP$; "]"; INPUT magname$ magname$ = UCASE$(magname$) IF magname$ <> "" THEN magnameP$ = magname$ 'Get the name of the test stand 'stand: 'PRINT "Enter which test stand is being used (D0, D1, or D2): ["; teststandP$; "]"; 'INPUT teststand$ 'teststand$ = UCASE$(teststand$) 'IF teststand$ <> "" THEN teststandP$ = teststand$ 'IF teststand$ <> "" AND teststand$ <> "D0" AND teststand$ <> "D1" AND teststand$ <> "D2" THEN GOTO stand 'IF teststandP$ = "" GOTO stand 'Get the name of the measurement coil 'meascoil: 'PRINT "Enter the name of the measurement coil (COIL0, COIL1, or COIL2): ["; coilP$; "]"; 'INPUT coil$ 'coil$ = UCASE$(coil$) 'IF coil$ <> "" THEN coilP$ = coil$ 'IF coil$ <> "" AND coil$ <> "COIL0" AND coil$ <> "COIL1" AND coil$ <> "COIL2" THEN GOTO meascoil 'IF coilP$ = "" GOTO meascoil 'Get the operator's name(s) PRINT "Enter the operator(s) name(s): ["; operatorP$; "]"; INPUT operator$ IF operator$ <> "" THEN operatorP$ = operator$ 'Get the run number PRINT "What is the run number (1, 2, 3, ...): ["; runP$; "]"; INPUT run$ IF run$ <> "" THEN runP$ = run$ 'Get a comment PRINT "Enter any comment about the run: ["; commentP$; "]"; INPUT comment$ IF comment$ <> "" THEN commentP$ = comment$ 'See if everything was entered correctly PRINT INPUT "Do you wish to make any changes to the values entered (Y or N): ", yn$ IF yn$ = "Y" OR yn$ = "y" THEN GOTO begin END SUB SUB measure (coil%) '**************************************************************************** 'This subroutine controls the measurement of the integrated field strength 'as a function of current for the B-Factory high energy ring dipoles. 'Constants come from param.inc. ' 'Input: ' coil%, the coil number ' 'Zachary Wolf '5/15/94 '**************************************************************************** 'Simplify the notation n% = vcoilnptsP% t! = vcoildeltatP! nave% = vcoilnaveP% 'Initialize data arrays DIM vtp!(1 TO nave%) 'holds +vt values during averaging DIM vtn!(1 TO nave%) 'holds -vt values during averaging 'Get the parameters for the teststand being used IF coil% = 0 THEN c% = coil0chanP% ELSEIF coil% = 1 THEN c% = coil1chanP% ELSEIF coil% = 2 THEN c% = coil2chanP% END IF 'Message PRINT "Measuring the integrated voltage from coil "; c%; "..." 'Measure the current before the coil measurement CALL imagmeas(imagchanP%, vtransperimagP!, ibef!) 'Measure the voltage integral CALL vcoilcntvt(c%, n%, t!, nave%, vtp!(), vtn!(), vt!, sigvt!) 'Measure the current after the coil measurement CALL imagmeas(imagchanP%, vtransperimagP!, iaft!) 'Write the voltage integrals to the log file CALL logvt(logfileP$, c%, ibef!, iaft!, nave%, vtp!(), vtn!()) 'Message PRINT "The integrated voltage is "; vt!; " +- "; sigvt!; " Vs" 'Compute the average current iave! = (ibef! + iaft!) / 2 'Write the results to the log file CALL logsumm(logfileP$, c%, iave!, vt!, sigvt!) END SUB