;+ ; NAME: ; DSN_CONFLICT_7DAY ; PURPOSE: ; Identify ASCA/Yohkoh DSN conflicts from DSN 7dayss plan. ; Produce a suggested pass deletion plan for the 7dayss ; CALLING SEQUENCE: ; IDL> .run dsn_conflict ; MODIFICATION HISTORY: ; 4-aug-94, J. R. Lemen LPARL, V0.1 Written ; 27-Jan-95, JRL, Fixed loop in formatter2 so last pass is printed ; 22-Oct-95, JRL, V1.1 Changed printing to use pprint ; 6-Mar-98, HSH, V1.2 Compatible with Wallops sched (hardwired paths; ; change all ASTD to AST) ; 11-Oct-98, T Yoshida, fixed a scalar/vector problem (see code) ;- ;======================================================================== function dsn_pass_opt,pass,use_code,elapse_total,elapse_exclude,asca=asca ;+ ; NAME: ; dsn_pass_opt ; PURPOSE: ; Optimize the selection of DSN passes by ASCA and Yohkoh ; CALLING SEQUENCE: ; use_code_new = dsn_pass_opt(pass,use_code,elapse_total,elapse_exclude) ; use_code_new = dsn_pass_opt(pass,use_code,elapse_total,elapse_exclude,/asca) ; ; ASCA Algorithm: ; 1. Compute e2 = elapse_time (between EOT and next BOT) - T_SAA ; 2. Do not use pass unless e2 >= 80. min ; ; Yohkoh Algorithm: ; 1. Compute e2 = elapse_time (between EOT and next BOT) - T_Night ; 2. Do not use pass unless e2 >= 42. min ; 3. If more than one pass has e2 >= 42. and e2 <= 84. min, choose ; the pass that is in night or within 5. min of night. ; ; MODIFICATION HISTORY: ; 4-aug-94, J. R. Lemen LPARL, Written ;- use_code2 = use_code SC_SC = ['SOL','AST'] q_sc = keyword_set(asca) jj = where((pass.user eq sc_sc(q_sc)) and (use_code2 eq 3),nc) pass_length = addtime(pass.eot1,diff=pass.bot1) ; Length of each pass if nc gt 0 then use_code2(jj) = 1 ; Turn on all passes that had been previously eliminated if q_sc then begin ; ASCA optimization parameters dt_max = 8.5 ; Max required time to dump ASCA BDR t_min = 68. ; (min) = Time_BDR (time before ASCA passes are selected) t_max = 150. numx = 5 endif else begin ; Yohkoh optimization parameters t_min = 42. ; (Min) = Time_BDR (time before Yohkoh passes are selected) t_max = 3*t_min ; numx = 6 endelse pass_length = addtime(pass.eot1,diff=pass.bot1) ; Length of each pass (EOT-BOT) jj = where((pass.user eq sc_sc(q_sc)) and (use_code2 eq 1),nj) i0 = jj(0) for i=1,nj-1 do begin if pass(jj(i)).dss ne 99 then begin ; Always take the KSC contacts ; Compute the cases for the next numx+1 contacts subs = jj(i:(i+numx)<(nj-1)) elapse_time,pass,e1,e2,saa=q_sc,asca=q_sc,night=1-q_sc,/all,ss=[i0,subs] e1 = e1(1:*) ; Elapsed time (min) e2 = e2(1:*) ; Elapsed time (min) ; e2 = elapsed_time - T_SAA (ASCA) or if e2(0) lt T_min then begin ; e2 = elapsed_time - T_NIGHT (Yohkoh) use_code2(jj(i)) = 3 ; Too short an interval (don't use) if i eq 0 then begin ;*** print,'i=0' ;*** stop endif endif else begin ij = where((e2 lt t_max) and (e2 ge t_min),ngood) if q_sc then begin ; ASCA if ngood gt 1 then begin ; print,'Current:',pass(i0).bot,pass(i0).doy,format='(a,3x,i4.4,i10)' ;*** ; for j=0,ngood-1 do print,ij(j),e2(ij(j)), $ ;*** ; pass(jj(i+ij(j))).bot,pass_length([jj(i),jj(i+ij(j))]),format='(2i5,i5.4,2f10.2)' ;*** ; print,'...................' ;*** endif if ngood le 1 then i0 = jj(i) else $ ; 1 or 0 passes in good range if pass_length(jj(i)) lt pass_length(jj(i+ij(1))) then begin use_code2(jj(i)) = 3 ; Will use the next pass since it is night endif else i0 = jj(i) ; Use this pass endif else begin ; YOHKOH if ngood gt 0 then begin ; print,'Current:',pass(i0).bot,pass(i0).doy,format='(a,3x,i4.4,i10)' ;*** ; for j=0,ngood-1 do print,ij(j),e2(ij(j)), $ ;*** ; pass(jj(i+ij(j))).bot,pass(jj(i+ij(j))).night,format='(2i5,i5.4,f10.2)' ;*** ; print,'...................' ;*** endif if ngood le 1 then i0 = jj(i) else $ ; 1 or 0 passes in good range if pass(jj(i)).night lt 5. then i0 = jj(i) else begin ; Current pass is near nightime if pass(jj(i+ij(1))).night lt 5. then begin ; Check if 2nd pass is at night use_code2(jj(i)) = 3 ; Will use the next pass since it is night endif else i0 = jj(i) ; Use this pass endelse endelse endelse endif else i0 = jj(i) ; Always take KSC passes endfor n_pass = n_elements(pass) if n_elements(elapse_total) eq 0 then elapse_total = fltarr(n_pass) if n_elements(elapse_exclude) eq 0 then elapse_exclude = fltarr(n_pass) elapse_total(jj) = 0. elapse_total(jj) = 0. jj = where((use_code2 eq 1) and (pass.user eq sc_sc(q_sc)),nc) elapse_time, pass, e_total, e_exclude, saa=q_sc, asca=q_sc, night=1-q_sc,ss=jj elapse_total(jj) = e_total elapse_exclude(jj) = e_exclude return,use_code2 end ;======================================================================= function get_elapse_time,pass,use_code, $ elapse_total,elapse_exclude,Time_elaps,asca=asca,optomize=optomize ;+ ; NAME: ; get_elapse_time ; PURPOSE: ; Calls elapse_time to get Non-night times between Yohkoh pases or ; non-SAA times between ASCA passes. ; ; CALLING SEQUENCE: ; new_use_code = get_elapse_time(pass,use_code,elapse_total,elapse_exclude,$ ; time_elaps [,/asca,/optomize]) ; INPUTS: ; pass - The DSN pass structure ; use_code - Vector describing use of the pass (1=use the pass) ; RETURNS: ; If the /optomize switch is set, new_use_code is updated, otherwise, ; the input use_code is returned with 3 set to 1. ; OUTPUTS: ; elapse_total - Total time between pases (but not included the pass itself) ; elapse_exclude- elapse_total - T_SAA for ASCA or elapse_total - T_Night for Yohkoh ; time_elaps - String vector that is used for the output format. ; OPTIONAL INPUT PARAMETERS: ; asca - If set, will process the ASCA contacts, otherwise, process Yohkoh. ; optomize - If set, call dsn_pass_opt to optimize pass slection ; MODIFICATION HISTORY: ; 4-aug-94, J. R. Lemen (LPARL), Written. ;- SC_SC = ['SOL','AST'] q_sc = keyword_set(asca) use_code2 = use_code if q_sc then fmt = "(' ',x,i4)" $ ; Asca else fmt = "(i4,x,' ')" ; Yohkoh if not keyword_set(optomize) then begin jj = where((pass.user eq sc_sc(q_sc)) and (use_code2 eq 3),nj) if nj gt 0 then use_code2(jj) = 1 ; Reset the use code jj = where((pass.user eq sc_sc(q_sc)) and (use_code2 eq 1),nj) elapse_time, pass(jj), e_total, e_exclude, asca=q_sc, $ saa=q_sc, night=1-q_sc,/verbose endif else begin jj = where(pass.user eq sc_sc(q_sc),nj) use_code2(jj) = dsn_pass_opt(pass(jj), use_code(jj), e_total, e_exclude,asca=q_sc) endelse if n_elements(elapse_total) eq 0 then begin n_pass = n_elements(pass) elapse_total = fltarr(n_pass) elapse_exclude = fltarr(n_pass) Time_elaps = replicate(strmid(' ',0,9),n_pass) endif elapse_total(jj) = e_total elapse_exclude(jj) = e_exclude for i=1,nj-1 do Time_elaps(jj(i)) = string(round(elapse_exclude(jj(i))),format=fmt) return,use_code2 end ;================================================================== function ksc_groups, pass, n_groups, asca=asca, yohkoh=yohkoh ;+ ; NAME: ; ksc_groups ; PURPOSE: ; Find ajacent KSC passes (that are within 10 hours of each other) ; CALLING SEQUENCE: ; ksc_passes = ksc_groups(pass,n_groups) ; Defaults to both ; ksc_passes = ksc_groups(pass,n_groups,asca=0) ; ksc_passes = ksc_groups(pass,n_groups,asca=0,yohkoh=0) ; MODIFICATION HISTORY: ; 4-aug-94, J. R. Lemen, LPARL ;- if n_elements(asca) eq 0 then qasca = 1 else qasca = asca if n_elements(yohkoh) eq 0 then qyoh = 1 else qyoh = yohkoh ksc_time = 10. * 60. ; Length of time window for KSC passes n_pass = n_elements(pass) SC = ['SOL','AST'] k0 = 1 & k1 = 0 if qasca then k1 = 1 if qyoh then k0 = 0 code = intarr(n_pass) n_groups = 0 for k=k0,k1 do begin jj = where((pass.dss eq 99) and (strupcase(pass.user) eq SC(k)), nc) t0 = pass(jj(0)) if nc gt 0 then $ n_groups = n_groups + 1 for i=0,nc-1 do begin if addtime(pass(jj(i)).bot1,diff=t0.bot1) gt ksc_time then begin t0 = pass(jj(i)) n_groups = n_groups + 1 endif code(jj(i)) = n_groups endfor endfor return,code end ;================================================================== function dsn_downlink, pass, N_pass, N_complete, asca=asca, str=str ;+ ; NAME: ; dsn_downlink ; PURPOSE: ; Compute the amount of DSN downlink time (in min) ; MODIFICATION HISTORY: ; 4-aug-94, J. R. Lemen LPARL, Written. ;- ; The overhead rates assume that ASCA requires if keyword_set(asca) then begin jj = where((pass.user eq 'AST') and (pass.dss ne 99),N_pass) overhead = 1.5 ; Assumed ASCA Overhead in minutes t_max = 8.5 ; Required time (min) for full BDR dump SC = 'AST' endif else begin jj = where((pass.user eq 'SOL') and (pass.dss ne 99),N_pass) overhead = 2.5 ; Overhead in minutes t_max = 5.5 ; Required time (min) for full BDR dump SC = 'SOL' endelse pass_length = addtime(pass(jj).eot1,diff=pass(jj).bot1) ; Length of each pass (min) xx = where(pass_length ge overhead+t_max, N_complete) pass_length = pass_length < (overhead+t_max) num_tot = total(pass_length-overhead) if keyword_set(str) then num_tot = $ string(SC,': Total DSN downlink time:',num_tot, $ ' min; # passes:',n_pass,'; # complete:', $ n_complete,' (',round(100.*n_complete/n_pass) $ ,'%)', format='(2a,f7.1,a,i4,a,i4,a,i3,a)') return,num_tot end ;======================================================================== pro check_this,pass,num if n_elements(num) eq 0 then nnn = '???' else nnn = strtrim(num,2) SC = ['SOL','AST'] k0 = 0 & k1 = 1 for k=k0,k1 do begin jj = where((pass.dss eq 99) and (strupcase(pass.user) eq SC(k)), nc) if nc eq 0 then begin print,'Where are corrupted again!?! ',nnn stop endif endfor end ;======================================================================== pro elapse_time, passx, elapse_total, elapse_exclude, $ num_interv, saa=saa, night=night, asca=asca, ss=subs, all=all, verbose=verbose ;+ ; MODIFICATION HISTORY: ; 4-aug-94, J. R. Lemen LPARL, Written ;- common elapse_fem,fem_data_prev,qtt1,qtt2,qasca if n_elements(subs) eq 0 then pass = passx else pass = passx(subs) n_pass = n_elements(pass) & n_passx = n_elements(passx) ; - - - - - - - - - - - - - - - - - ; Step 1: Get the FEM data ; - - - - - - - - - - - - - - - - - SC = ['Yohkoh','ASCA '] tt1 = addtime(passx(0).start1,del=-110.) ; Go 100 minutes earlier tt2 = addtime(passx(n_passx-1).endd1,del=+110.) ; Go 100 minutes later if n_elements(qtt1) eq 0 then qread = 1 else $ if (addtime(qtt1,diff=tt1) eq 0.) and $ (addtime(qtt2,diff=tt2) eq 0.) and $ (keyword_set(asca) eq qasca) then qread = 0 else qread = 1 if qread then begin print,' Getting ',SC(keyword_set(asca)),' Fem data from ',fmt_tim(tt1),' to ',fmt_tim(tt2) rd_fem,tt1,tt2,fem_data,asca=asca qtt1 = tt1 qtt2 = tt2 qasca = keyword_set(asca) fem_data_prev = fem_data endif else fem_data = fem_data_prev ; - - - - - - - - - - - - - - - - - ; Step 2: Set up the output variables ; - - - - - - - - - - - - - - - - - elapse_total = fltarr(n_pass) ; Total time between EOT and BOT elapse_exclude = fltarr(n_pass) ; elapse_total minus night time or SAA time num_interv = intarr(n_pass) ; Number of intervals of night+SAA for i=0,n_pass-2 do if not keyword_set(all) then $ elapse_total(i+1) = addtime(pass(i+1).BOT1,diff=pass(i).EOT1) else $ elapse_total(i+1) = addtime(pass(i+1).BOT1,diff=pass(0).EOT1) if keyword_set(night) then k0=0 else k0=1 if keyword_set(saa) then k1=1 else k1=0 for k=k0,k1 do begin case k of 0: begin ; exclude night evn1 = (anytim2ints(fem_data))(1:*) ; End night evn0 = anytim2ints(fem_data,offset=fem_data.night) ; Start night evn0 = evn0(0:n_elements(evn1)-1) if keyword_set(verbose) then message,'Removing night times for '+SC(keyword_set(asca)),/info endcase 1: begin ; exclude SAA jj = where(fem_data.st_saa-fem_data.en_saa ne 0,nj) evn0 = anytim2ints(fem_data(jj),offset=fem_data(jj).st_saa) ; Start SAA evn1 = anytim2ints(fem_data(jj),offset=fem_data(jj).en_saa) ; End SAA if keyword_set(verbose) then message,'Removing SAA times for '+(['Yohkoh','ASCA'])(keyword_set(asca)),/info endcase endcase evn0 = int2secarr(evn0, tt1) evn1 = int2secarr(evn1, tt1) if not keyword_set(all) then $ EOT1 = int2secarr(pass.EOT1, tt1) else $ EOT1 = replicate(int2secarr(pass(0).EOT1, tt1),n_elements(pass.BOT1)) BOT1 = int2secarr(pass.BOT1, tt1) for i=0,n_pass-2 do begin ij = where((((evn0-EOT1(i)) gt 0) or $ ((evn1-EOT1(i)) gt 0)) and $ (((BOT1(i+1)-evn0) gt 0) or $ ((BOT1(i+1)-evn1) gt 0)),nc) num_interv(i+1) = num_interv(i+1) + nc exclude_xx = 0. if nc gt 0 then begin temp0 = evn0(ij) temp1 = evn1(ij) for j=0,n_elements(temp0)-1 do begin if (temp0(j)-EOT1(i)) lt 0 then temp0(j) = EOT1(i) if (temp1(j)-BOT1(i+1)) gt 0 then temp1(j) = BOT1(i+1) endfor for j=0,n_elements(temp0)-1 do exclude_xx = exclude_xx + (temp1(j)-temp0(j)) endif ; nc gt 0 elapse_exclude(i+1) = elapse_total(i+1) - exclude_xx / 60. endfor ; i=0,n_pass-2 endfor ; k=k0,k1 end ;======================================================================== function ksc_pass, pass, check_time, asca=asca ;+ ; MODIFICATION HISTORY: ; 4-aug-94, J. R. Lemen LPARL, Written ;- n_pass = n_elements(pass) pass2 = pass ; - - - - - - - - - - - - - - - - - ; Step 1: Get the FEM data ; - - - - - - - - - - - - - - - - - SC = ['Yohkoh','ASCA '] SC1 = ['SOL','AST'] tt1 = addtime(pass(0).start1,del=-110.) ; Go 100 minutes earlier tt2 = addtime(pass(n_pass-1).endd1,del=+110.) ; Go 100 minutes later print,' Getting ',SC(keyword_set(asca)),' Fem data from ',fmt_tim(tt1),' to ',fmt_tim(tt2) rd_fem,tt1,tt2,fem_data,asca=asca ; - - - - - - - - - - - - - - - - - ; Step 2: Loop through the Fem_data and insert KSC contacts ; - - - - - - - - - - - - - - - - - passxx = pass(0) for i=0,n_elements(fem_data)-1 do begin ; Make sure the KSC data is within the time range if (addtime(fem_data(i),diff=pass(0).start1) ge 0) and $ (addtime(fem_data(i),diff=pass(n_pass-1).endd1) le 0) then begin for j=0,2 do begin if string(fem_data(i).st$station(j)) eq 'U' then begin pass_length = (fem_data(i).en_station(j)-fem_data(i).st_station(j)) / 60. if pass_length ge check_time then begin bot = addtime(fem_data(i),del=fem_data(i).st_station(j)/60.) eot = addtime(fem_data(i),del=fem_data(i).en_station(j)/60.) passxx.Year = bot(6) passxx.start = bot(0)*100 + bot(1) passxx.bot = passxx.start passxx.eot = eot(0)*100 + eot(1) passxx.endd = passxx.eot passxx.start1= anytim2ints(bot) passxx.bot1 = passxx.start1 passxx.eot1 = anytim2ints(eot) passxx.endd1 = passxx.eot1 ;11-Oct-1998 Modified by T. Yoshida ;Original (until 10-Oct-1998) ; passxx.doy = anytim2doy(passxx.start1) passxx.doy = (anytim2doy(passxx.start1))(0) passxx.dss = 99 passxx.user = sc1(keyword_set(asca)) passxx.pass = ' ' passxx.config= ' ' pass2 = [pass2,passxx] endif endif endfor endif endfor ; - - - - - - - - - - - - - - - - - ; Step 3: Time order everything ; - - - - - - - - - - - - - - - - - pass2 = pass2(bsort(int2secarr(pass2.bot1))) ; - - - - - - - - - - - - - - - - - - - ; Step 4: Add night information to Yohkoh passes ; - - - - - - - - - - - - - - - - - - - if not keyword_set(asca) then begin jj = where(pass2.user eq sc1(keyword_set(asca))) tim2orbit,pass2(jj).bot1,tim2night=tim2night1 ; Doesn't allow an /asca switch tim2orbit,pass2(jj).eot1,tim2night=tim2night2 pass2(jj).night = tim2night1