DECLARE SUB GetTime (plottime$) DECLARE SUB GetDate (plotdate$) DECLARE SUB GetMagnetRun (mag$(), runnumber$) DECLARE SUB DisplayFileInfo (mag$(), runnumber$, magday$(), magtime$(), include$(), include2$()) DECLARE SUB OutputData (mag$(), runnumber$, magday$(), magtime$(), include$(), include2$()) DECLARE SUB PlotData (mag$()) 'RTSUM: This program summarizes the measurements made during ' a Resistance and Temperature run. It extracts the ' first measurement and appends it to the summary file RESSUM.DAT. ' 'Phil Radusewicz 8/11/94 DIM mag$(1 TO 2) CALL GetMagnetRun(mag$(), runnumber$) CALL PlotData(mag$()) SUB DisplayFileInfo (mag$(), runnumber$, magday$(), magtime$(), include$(), include2$()) 'Display the magnet file information: FOR m = 1 TO 2 CLS filein% = FREEFILE IF VAL(runnumber$) < 10 THEN infile$ = "\magdata\" + mag$(m) + "\rtlog.ru" + runnumber$ IF VAL(runnumber$) > 10 THEN infile$ = "\magdata\" + mag$(m) + "\rtlog.r" + runnumber$ 'IF val(runnumber$) < 10 THEN infile$ = "\philr\bfact\data\rtlog.ru" + runnumber$ 'IF val(runnumber$) > 10 THEN infile$ = "\philr\bfact\data\rtlog.r" + runnumber$ OPEN infile$ FOR INPUT AS filein% FOR i = 1 TO 18 LINE INPUT #filein%, include$(m) IF i = 2 THEN magday$(m) = include$(m) IF i = 3 THEN magtime$(m) = include$(m) PRINT include$(m) NEXT FOR i = 19 TO 38 LINE INPUT #filein%, include2$(m) NEXT CLOSE filein% IF m = 1 THEN PRINT PRINT "Press any key to see information on the next magnet: "; INPUT temp$ END IF IF m = 2 THEN PRINT PRINT "Press any key to continue: "; INPUT temp$ END IF NEXT END SUB SUB GetDate (plotdate$) plotdate$ = DATE$ 'Reformat the file date: day$ = MID$(plotdate$, 1, 2) mon$ = MID$(plotdate$, 4, 2) year$ = MID$(plotdate$, 9, 2) plotdate$ = day$ + "/" + mon$ + "/" + year$ END SUB SUB GetMagnetRun (mag$(), runnumber$) DIM magday$(2), magtime$(2), include$(2), include2$(2) CLS PRINT PRINT PRINT "RTSUM: Program summary of the Resistance and Temperature measurements" PRINT " made on the B-Factory dipoles during production testing." PRINT PRINT "Would you like to include a new set of magnets in the summary [N]: "; INPUT response$ response$ = UCASE$(response$) IF response$ = "Y" THEN PRINT PRINT "Input magnet name on test stand D1: "; INPUT mag$(1) PRINT "Input magnet name on test stand D2: "; INPUT mag$(2) PRINT "Input run number: "; INPUT runnumber$ CALL DisplayFileInfo(mag$(), runnumber$, magday$(), magtime$(), include$(), include2$()) CALL OutputData(mag$(), runnumber$, magday$(), magtime$(), include$(), include2$()) END IF END SUB SUB GetTime (plottime$) T$ = TIME$ hr = VAL(T$) IF hr < 12 THEN ampm$ = " AM" ELSE ampm$ = " PM" IF hr > 12 THEN hr = hr - 12 plottime$ = STR$(hr) + RIGHT$(T$, 6) + ampm$ END SUB SUB OutputData (mag$(), runnumber$, magday$(), magtime$(), include$(), include2$()) DIM d$(2) d$(1) = "1" d$(2) = "2" CLS PRINT PRINT PRINT "RTSUM: Program summary of Resistance and Temperature measurements" PRINT " made on the B-Factory dipoles during production testing." PRINT PRINT "The following magnet information has been entered:" PRINT PRINT USING "Magnet on test stand D1: &"; mag$(1) PRINT USING "Magnet on test stand D2: &"; mag$(2) PRINT USING "Magnet run number: &"; runnumber$ PRINT PRINT "Would you like to include this run in the summary [Y]: "; INPUT response$ response$ = UCASE$(response$) IF response$ <> "N" THEN PRINT FOR m = 1 TO 2 'Reformat the file date: day$ = MID$(magday$(m), 7, 2) mon$ = MID$(magday$(m), 10, 2) year$ = MID$(magday$(m), 15, 2) magday$(m) = day$ + "/" + mon$ + "/" + year$ 'Reformat the file time: magtime$(m) = MID$(magtime$(m), 7, 5) 'Reformat the output for the magnets under test: magtime$ = MID$(include$(m), 1, 5) cur$ = MID$(include$(m), 11, 6) vol$ = MID$(include$(m), 19, 6) res$ = MID$(include$(m), 28, 5) in$ = MID$(include$(m), 36, 5) out$ = MID$(include$(m), 44, 5) iron$ = MID$(include$(m), 52, 5) coil$ = MID$(include$(m), 60, 5) room$ = MID$(include$(m), 68, 5) PRINT USING "\ \ \\ & & & &"; mag$(m); runnumber$; d$(m); magday$(m); magtime$(m); PRINT USING "& & & & & & & &"; cur$; vol$; res$; in$; out$; iron$; coil$; room$ fileout% = FREEFILE outfile$ = "\philr\bfact\summary\rtsum.txt" OPEN outfile$ FOR APPEND AS fileout% PRINT #fileout%, USING "\ \ \\ & & & &"; mag$(m); runnumber$; d$(m); magday$(m); magtime$(m); PRINT #fileout%, USING "& & & & & & & &"; cur$; vol$; res$; in$; out$; iron$; coil$; room$ CLOSE fileout% NEXT PRINT PRINT "Added to file RTSUM.TXT" 'Reformat the output for the reference magnet: magtime$ = MID$(include2$(1), 1, 5) cur$ = MID$(include2$(1), 11, 6) vol$ = MID$(include2$(1), 19, 6) res$ = MID$(include2$(1), 28, 5) in$ = MID$(include2$(1), 36, 5) out$ = MID$(include2$(1), 44, 5) iron$ = MID$(include2$(1), 52, 5) coil$ = MID$(include2$(1), 60, 5) room$ = MID$(include2$(1), 68, 5) PRINT PRINT USING "000 & & "; magday$(1); magtime$(1); PRINT USING "& & & & & & & &"; cur$; vol$; res$; in$; out$; iron$; coil$; room$ fileout% = FREEFILE outfile$ = "\philr\bfact\summary\rtref.txt" OPEN outfile$ FOR APPEND AS fileout% PRINT #fileout%, USING "000 & & "; magday$(1); magtime$(1); PRINT #fileout%, USING "& & & & & & & &"; cur$; vol$; res$; in$; out$; iron$; coil$; room$ CLOSE fileout% PRINT PRINT "Added to file RTREF.TXT" END IF END SUB SUB PlotData (mag$()) DIM yname$(8) yname$(1) = "Current (A)" yname$(2) = "Voltage (V)" yname$(3) = "Resistance (mOhm)" yname$(4) = "Inlet Coolant Temperature (C)" yname$(5) = "Outlet Coolant Temperature (C)" yname$(6) = "Magnet Iron Temperature (C)" yname$(7) = "Measuring Coil Temperature (C)" yname$(8) = "Room Temperature (C)" group$ = "Summary File: RTSUM.TXT" PRINT PRINT "Would you like to plot any data [Y]: "; INPUT response$ response$ = UCASE$(response$) WHILE response$ <> "N" SHELL "cls" PRINT PRINT "RTSUM: Plot summary of Resistance and Temperature measurement" PRINT " made on the B-Factory dipoles during production testing." PRINT PRINT "Select from the following:" PRINT PRINT " 1) Magnet Current" PRINT " 2) Magnet Voltage" PRINT " 3) Magnet Resistance" PRINT " 4) Inlet Coolant Temperature" PRINT " 5) Outlet Coolant Temperature" PRINT " 6) Magnet Iron Temperature" PRINT " 7) Measuring Coil Temperature" PRINT " 8) Room Temperature" PRINT " 9) OUTPUT TO PRINTER" PRINT " 10) EXIT" PRINT PRINT "Input Selection: "; INPUT selection% IF selection% = 10 THEN EXIT SUB CALL GetTime(plottime$) CALL GetDate(plotdate$) plot% = 0 IF selection% = 9 THEN plot% = 1 PRINT "Input plot to print: "; INPUT selection% END IF td$ = "xiiiiiiiiiiiii" MID$(td$, 5 + selection%) = "y" fileout% = FREEFILE outfile$ = "\philr\bfact\batch\epbatch.txt" OPEN outfile$ FOR OUTPUT AS fileout% PRINT #fileout%, "/fpo bg" PRINT #fileout%, "//np_legend_box" PRINT #fileout%, "//nosv" PRINT #fileout%, "//def_leg_pos 0.16 0.875" PRINT #fileout%, "//rem_tmps" PRINT #fileout%, "//rev_curves" PRINT #fileout%, "//abs_err" PRINT #fileout%, " " IF plot% = 1 THEN PRINT #fileout%, "/fpp ps" PRINT #fileout%, "/ag" PRINT #fileout%, "/se y on" PRINT #fileout%, "/td ", td$ PRINT #fileout%, "/sc off" PRINT #fileout%, "/ac \philr\bfact\summary\rtsum.txt" PRINT #fileout%, "/et g 'B-Factory Dipole Measurements @ 650A: "; PRINT #fileout%, yname$(selection%); "'" PRINT #fileout%, "/et x 'Magnet Number'" PRINT #fileout%, "/et y "; "'"; yname$(selection%); "'" PRINT #fileout%, USING "/aa 0.02 0.02 'Date/Time: & &"; plotdate$; plottime$; PRINT #fileout%, "' A" PRINT #fileout%, "/aa 0.675 0.02 '"; group$; "' A" PRINT #fileout%, "//wait" IF plot% = 1 THEN PRINT #fileout%, "/fp p" PRINT #fileout%, "/ed g" PRINT #fileout%, "/fq y" CLOSE fileout% SHELL "\easyplot\ep \philr\bfact\batch\epbatch.txt" WEND END SUB