pro resource,Log ;PC version, uses DB2 if available. ;+ ; ; NAME: ; resource ; PURPOSE: ; Calculates usage of DISR limited life items: ; Shutter Cycles ; Lamp On-times ; Total DISR On-time ; CATEGORY: ; Verification ; CALLING SEQUENCE: ; resource ; INPUTS: ; None ; OPTIONAL INPUT PARAMETERS: ; NONE ; OUTPUTS: ; Log+'/resource.dat' ; OPTIONAL OUTPUT PARAMETERS: ; None ; KEYWORDS: ; None ; COMMON BLOCKS: ; c_system and c_header are required. ; SIDE EFFECTS: ; None ; RESTRICTIONS: ; None ; EXAMPLE: ; resource ; PROCEDURE: ; Calculate usage of DISR limited life items: ; First: Shutter Cycles ; Second: Lamp On-times ; Third: Total DISR On-time ; Write it to Log+'/resource.dat' ; MODIFICATION HISTORY: ; 23-06-1994 LED Extracted resource tracker from d_pstprc ; 24-06-1994 LED Tested on test log "baptism2" on 24 June 1994 ; Results of extracted routine match results of CFE routine. ; 7/22/97 csee Changed output directory to the current directory ; (instead of '~/resource_usage/'). Note: the ouput ; file is Log+'/resource.dat' ; ;---------------------------------------------------------------------------- ; D I S R S O F T (C) 1 9 9 4 ;----------------------------------------------------------------------------- ;- STATUS=STRARR(4) STATUS(0)='S' STATUS(1)='SUCCESS' ; USER enter name of routine inside quotes STATUS(2)='resource' ; leave this STATUS(3)='' ; enter version number inside quotes VERSION='V1.0' ; enter the full procedure call in here CALL='resource,Log' @c_system.inc @c_header.inc cd,'', current=cdir & cd,cdir ;csee 7/22/97 if n_params() eq 0 then log = cdir+'\' ;test for # of input parameters lastchar=strlen(Log)-1 if strmid(Log,lastchar) ne '\' then Log=Log+'\' ;check to see if Bushroe's processor has been run on this log - Passive. db='DB' file_ck=findfile(log+'DB2') if file_ck(0) ne '' then db='DB2' else print,'Cant find .\DB2, using \DB' ; error checking ---- insert maximum and minimum number of parameter IF (N_PARAMS(0) GT 1) THEN BEGIN STATUS(0)='F' STATUS(1)='FAILURE' STATUS(3)='Bad input parameters' PRINT,' ' PRINT,STRTRIM(STRUPCASE(STATUS(2)),2)+' : '+STATUS(3)+'. EXIT.' PRINT,'Call is '+CALL GOTO,LEAVE ENDIF ; determine the number of the shutter cycles print,SYSTIME(),' Shutter Cycles' ;spawn,'find DB/Ir DB/ShutTest -type f -print |sort_disrsoft_file',FILENAMES filenames1= file_search(Log+db+'\Ir','*MMX_*',count=nfiles1) filenames2= file_search(Log+db+'\ShutTest','*MMX_*',count=nfiles2) filenames=[filenames1+filenames2] z_names=size(FILENAMES) NUMBER_OUT=z_names(1) IF NUMBER_OUT EQ 0 or NUMBER_OUT EQ 7 THEN BEGIN SHUTTER_CYCLES=0L ENDIF ELSE BEGIN D_SHTTIM,FILENAMES,SHUTTER_CYCLES,STATUS1 IF STRUPCASE(STRMID(STRTRIM(STATUS1(0),2),0,1)) NE 'S' THEN BEGIN STATUS(0)='F' STATUS(1)='FAILURE' STATUS(3)='D_SHTTIM error '+STATUS1(3) PRINT,' ' PRINT,STRTRIM(STRUPCASE(STATUS(2)),2)+$ ' : '+STATUS(3)+'. EXIT.' GOTO,LEAVE ENDIF ENDELSE ; determine the length of time each lamp is on print,SYSTIME(),' Lamp Time' ;spawn,'find DB/Lamp -type f -print |sort_disrsoft_file',FILENAMES filenames= file_search(Log+db+'\Lamp','*MMX_*',count=nfiles) z_lamp=size(FILENAMES) NUMBER_OUT=z_lamp(1) IF NUMBER_OUT EQ 0 or NUMBER_OUT EQ 7 THEN BEGIN LAMP_TIMES=[0.,0.,0.,0.] ENDIF ELSE BEGIN D_LMPTIM,FILENAMES,LAMP_TIMES,STATUS1 IF STRUPCASE(STRMID(STRTRIM(STATUS1(0),2),0,1)) NE 'S' THEN BEGIN STATUS(0)='F' STATUS(1)='FAILURE' STATUS(3)='D_LMPTIM error '+STATUS1(3) PRINT,' ' PRINT,STRTRIM(STRUPCASE(STATUS(2)),2)+$ ' : '+STATUS(3)+'. EXIT.' GOTO,LEAVE ENDIF ENDELSE ; determine the length of time DISR is on print,SYSTIME(),' DISR Time' ;spawn,'find DB/Time -type f -print |sort_disrsoft_file',FILENAMES filenames= file_search(Log+db+'\Time','*MMX_*',count=nfiles) z_time=size(FILENAMES) NUMBER_OUT=z_time(1) IF NUMBER_OUT EQ 0 or NUMBER_OUT EQ 7 THEN BEGIN DISR_ON_TIME=0.0 ENDIF ELSE BEGIN D_DSRTIM,FILENAMES,DISR_ON_TIME,/analyse,STATUS1 IF STRUPCASE(STRMID(STRTRIM(STATUS1(0),2),0,1)) NE 'S' THEN BEGIN STATUS(0)='F' STATUS(1)='FAILURE' STATUS(3)='D_DSRTIM error '+STATUS1(3) IF STATUS_SET NE 1 THEN BEGIN PRINT,' ' PRINT,STRTRIM(STRUPCASE(STATUS(2)),2)+$ ' : '+STATUS(3)+'. EXIT.' ENDIF GOTO,LEAVE ENDIF ENDELSE ; write the data away D_RESTAB,Log,LAMP_TIMES,SHUTTER_CYCLES,DISR_ON_TIME,STATUS1 IF STRUPCASE(STRMID(STRTRIM(STATUS1(0),2),0,1)) NE 'S' THEN BEGIN STATUS(0)='F' STATUS(1)='FAILURE' STATUS(3)='D_RESTAB error '+STATUS1(3) PRINT,' ' PRINT,STRTRIM(STRUPCASE(STATUS(2)),2)+$ ' : '+STATUS(3)+'. EXIT.' GOTO,LEAVE ENDIF ; end of resource tracking section LEAVE: spawn,'Notepad '+Log+'resource.dat' cd,cdir RETURN END