DECLARE SUB fileinitl (test$, run$, logfile$, ok$) DECLARE SUB fileheader (logfile$, mn$, op$, ts$, dv$, rn$, cm$) DECLARE SUB gettestparam () DECLARE SUB measure (coil%) DECLARE SUB imagmeas (imag!) DECLARE SUB imagramp (rr!, ifin!) DECLARE SUB vcoilcvt (coil%, nave%, vtp!(), vtn!(), vt!, sigvt!) DECLARE SUB vcoillogvt (logfile$, m%, i1!, i2!, nave%, vtp!(), vtn!(), vt!, sigvt!) DECLARE SUB fileopenout (file$, ok$) DECLARE SUB fileheader1 (logfile$, mn$, op$, ts$, dv$, rn$, cm$) 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 testparam: CALL gettestparam 'Open the log file CALL fileinitl("test", runP$, logfileP$, ok$) IF ok$ <> "y" THEN PRINT : PRINT "Problem opening the log file. Try another run number.": PRINT GOTO testparam: END IF 'Write a header to the log file CALL fileheader(logfileP$, magnameP$, operatorP$, "D0, 1, or 2", "Coil 0, 1, or 2", runP$, commentP$) '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! > 1000! THEN PRINT "The current must be between 0 2 THEN PRINT "The coil channel 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!, 0!) 'Message PRINT "The test is finished." END 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 operator's name(s) PRINT "Enter the operator(s) name(s): ["; operatorP$; "]"; INPUT operator$ IF operator$ <> "" THEN operatorP$ = operator$ '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 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$; "]"; LINE 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 channel number ' 'Zachary Wolf '5/15/94 '**************************************************************************** 'Initialize data arrays, redimension upon use DIM vtp!(1 TO 2) 'holds +vt values during averaging DIM vtn!(1 TO 2) 'holds -vt values during averaging 'Message PRINT "Measuring the integrated voltage from coil channel "; coil%; "..." 'Measure the current before the coil measurement CALL imagmeas(ibef!) 'Measure the voltage integral CALL vcoilcvt(coil%, nave%, vtp!(), vtn!(), vt!, sigvt!) 'Measure the current after the coil measurement CALL imagmeas(iaft!) 'Write the voltage integrals to the log file CALL vcoillogvt(logfileP$, coil%, ibef!, iaft!, nave%, vtp!(), vtn!(), vt!, sigvt!) 'Message PRINT "The integrated voltage is "; vt!; " +- "; sigvt!; " Vs" END SUB