DECLARE SUB getstrparam (parname$, parval$) '**************************************************************************** 'Module GETPARAM 'This module contains subroutines to prompt the operator for parameters 'for the test. ' 'Zachary Wolf '5/8/95 '**************************************************************************** 'Parameters used by this module COMMON SHARED /getparam/ nparamfileP%, paramfileP$() SUB getfltparam (parname$, fltvalue!) '**************************************************************************** 'This subroutine gets the value of a float parameter. ' 'Input: ' parname$, string giving the parameter name ' 'Output: ' fltvalue!, float parameter value ' 'Zachary Wolf '1/19/96 '**************************************************************************** 'Get a string containing the parameter value CALL getstrparam(parname$, strvalue$) 'Extract the float value from the string fltvalue! = VAL(strvalue$) END SUB SUB getintparam (parname$, intvalue%) '**************************************************************************** 'This subroutine gets the value of an integer parameter. ' 'Input: ' parname$, string giving the parameter name ' 'Output: ' intvalue%, integer parameter value ' 'Zachary Wolf '1/19/96 '**************************************************************************** 'Get a string containing the parameter value CALL getstrparam(parname$, strvalue$) 'Extract the integer value from the string intvalue% = VAL(strvalue$) END SUB SUB getparamfile '**************************************************************************** 'This subroutine reads the file PARAM.DAT into a string array for future use. ' 'Zachary Wolf '1/31/96 '**************************************************************************** 'Dimension the string array to store the paramater info DIM paramfileP$(1 TO 300) 'Open the parameter file filenum% = FREEFILE OPEN "param.dat" FOR INPUT AS #filenum% 'Read the parameter file into its storage array nparamfileP% = 0 DO UNTIL EOF(filenum%) nparamfileP% = nparamfileP% + 1 LINE INPUT #filenum%, paramfileP$(nparamfileP%) LOOP 'Close the parameter file CLOSE filenum% END SUB SUB getstrparam (parname$, parval$) '**************************************************************************** 'This subroutine gets the value of an input parameter from the parameter 'file. ' 'Input: ' parname$, name of the parameter whose value is desired ' 'Output: ' parval$, value of the desired parameter ' 'Zachary Wolf '1/31/96 '**************************************************************************** 'Loop over the parameter file contents FOR i% = 1 TO nparamfileP% 'Extract the current line inline$ = paramfileP$(i%) 'Skip comments and empty lines IF MID$(inline$, 1, 1) = "'" THEN GOTO noequation IF inline$ = "" THEN GOTO noequation 'See if the current line has an = sign eqflag$ = "n" FOR j% = 1 TO LEN(inline$) IF MID$(inline$, j%, 1) = "=" THEN lhs$ = MID$(inline$, 1, j% - 1) rhs$ = MID$(inline$, j% + 1) eqflag$ = "y" EXIT FOR END IF NEXT j% IF eqflag$ = "n" THEN GOTO noequation 'Clean up LHS lhs$ = LTRIM$(lhs$) lhs$ = RTRIM$(lhs$) 'Clean up RHS, remove comments after values rhs$ = LTRIM$(rhs$) FOR j% = 1 TO LEN(rhs$) IF MID$(rhs$, j%, 1) = "'" THEN rhs$ = MID$(rhs$, 1, j% - 1) EXIT FOR END IF NEXT j% rhs$ = RTRIM$(rhs$) 'See if this is the desired parameter IF lhs$ = parname$ THEN parval$ = rhs$ EXIT SUB END IF 'End of loop over parameter file contents noequation: NEXT i% 'If we made it here, the parameter was not found BEEP PRINT PRINT "GETPARAM: Problem, the parameter " + parname$ + " was not found." INPUT "Should the program continue? (y/n) ", yn$ IF UCASE$(LTRIM$(yn$)) = "N" THEN STOP END SUB SUB gettestparam (projectP$, magtypeP$, magnameP$, barcodeP$, teststandP$, coilnameP$, operatorP$, runP$, commentP$) '**************************************************************************** 'This subroutine prompts the operator for the magnet name and other 'parameters of the test. ' 'Output: ' projectP$, name of the project ' magtypeP$, magnet type ' magnameP$, name of magnet (serial #) ' barcodeP$, barcode number on the magnet ' teststandP$, the teststand being used ' coilnameP$, the ID of the measurement coil ' operatorP$, name of the operator doing the test ' runP$, run number ' commentP$, comment about the test ' 'Zachary Wolf '7/8/94, 5/8/95, 7/26/95 '**************************************************************************** begin: 'Get the project name PRINT PRINT "What is the name of the project the magnet is for? " PRINT "(8 characters or less): ["; projectP$; "]"; INPUT project$ project$ = UCASE$(project$) IF project$ <> "" THEN projectP$ = project$ 'Get the magnet type PRINT "What is the magnet type (dipole, quad, PMblock)? " PRINT "(8 characters or less): ["; magtypeP$; "]"; INPUT magtype$ magtype$ = UCASE$(magtype$) IF magtype$ <> "" THEN magtypeP$ = magtype$ 'Get the name of the magnet PRINT "What is the name (serial #) of the magnet?" PRINT "(8 characters or less): ["; magnameP$; "]"; INPUT magname$ magname$ = UCASE$(magname$) IF magname$ <> "" THEN magnameP$ = magname$ 'Get the bar code number PRINT "What is the bar code number of the magnet ["; barcodeP$; "]"; INPUT barcode$ barcode$ = UCASE$(barcode$) IF barcode$ <> "" THEN barcodeP$ = barcode$ 'Get the name of the test stand PRINT "Enter which test stand is being used: ["; teststandP$; "] "; INPUT "", teststand$ teststand$ = UCASE$(teststand$) IF teststand$ <> "" THEN teststandP$ = teststand$ 'Get the name of the measurement coil PRINT "Enter the name of the measurement coil or system: ["; coilnameP$; "] "; INPUT "", coil$ coil$ = UCASE$(coil$) IF coil$ <> "" THEN coilnameP$ = coil$ '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$; "]"; 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 gettestparama (projectP$, magtypeP$, magnameP$, coilnameP$, operatorP$, runP$, commentP$) '**************************************************************************** 'This subroutine prompts the operator for the magnet name and other 'parameters of the test. ' 'Output: ' projectP$, name of the project ' magtypeP$, magnet type ' magnameP$, name of magnet (serial #) ' coilnameP$, the ID of the measurement coil ' operatorP$, name of the operator doing the test ' runP$, run number ' commentP$, comment about the test ' 'Zachary Wolf '7/8/94, 5/8/95, 7/26/95, 7/11/96 '**************************************************************************** begina: 'Get the project name PRINT 'PRINT "What is the name of the project the magnet is for? " 'PRINT "(8 characters or less): ["; projectP$; "]"; 'INPUT project$ 'project$ = UCASE$(project$) 'IF project$ <> "" THEN projectP$ = project$ projectP$ = "PEP2INT" 'Get the magnet type PRINT "What is the magnet type (q1d, q1q)? " PRINT "(8 characters or less): ["; magtypeP$; "]"; INPUT magtype$ magtype$ = UCASE$(magtype$) IF magtype$ <> "" THEN magtypeP$ = magtype$ 'Get the name of the magnet PRINT "What is the name (serial #) of the magnet?" PRINT "(8 characters or less): ["; magnameP$; "]"; INPUT magname$ magname$ = UCASE$(magname$) IF magname$ <> "" THEN magnameP$ = magname$ 'Get the name of the measurement coil 'PRINT "Enter the name of the measurement coil or system: ["; coilnameP$; "] "; 'INPUT "", coil$ 'coil$ = UCASE$(coil$) 'IF coil$ <> "" THEN coilnameP$ = coil$ coilnameP$ = "HH Coil" '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$; "]"; 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 begina END SUB