pro sata_block_Reader, $ header_v, header_out, segnale_out, n_batch, check_ch, filename ;--Opzioni di compilazione-- COMPILE_OPT STRICTARR COMMON PCRDV_info_c , PCRDV_info , mat_data_intern_var_list , segnale , puntatore , vett_info_signal DSRM_LIB ;Dimensione file e calcolo parole a 32-bit file_size_byte = (file_info(filename)).size IF file_size_byte NE 0 then begin vector = LONARR(file_size_byte/4L) ;lettura word da 32-bit openr, lun, filename, /get_lun point_lun, lun, 0 readu, lun, vector MARKER_BLOCK = LONG('5A5A5A5A'x) idxBloks = long64(where((vector EQ MARKER_BLOCK), Num_blocks)) ptrInput = where( (idxBloks-shift(idxBloks,1)) eq 1 ) - 1 ; serve a trovare il secondo pezzo "5A5A5A5A" consecutivo (in qs modo sono sicuro di aver trovato un nuovo blocco dati) ixBlocks = idxBloks[ptrInput] num_Blocks = n_elements(ixBlocks) ; ---> variabile creata giĆ  3 righe sopra NAME_BLOCK_V = lonarr(num_Blocks) NAME_BLOCK_V = vector[ixBlocks+17] ; nome blocco si trova 17 word ( da 4byte ciascuna) dopo il marker ;Identifico il numero di batch, che corrisponde al numero di header presenti index_hdr = where(NAME_BLOCK_V EQ 1213223748L, n_batch) ;index_hdr = index_hdr[2*lindgen(n_batch/2)] ;n_batch=n_batch/2 IF (n_batch NE 0) then begin ;Definizione Header idx_first_header = ixBlocks[index_hdr[0]] ;Controllo REV_ID IF (vector[idx_first_header+37] GT 2) THEN header_gen_v2, header ELSE header_gen, header dim_header = n_elements(struct2long(header)) long2struct , vector[idx_first_header:idx_first_header+dim_header-1] , header NPRI_v = header.header_data.signal_descr.PACKETDESCR.npri NRBIN_v = header.header_data.signal_descr.PACKETDESCR.nrbin batch_id = 0 sum = 0 guard = 0 daz = 0 del = 0 ;Leggo i dati per ogni blocco e identifico la tipologia NAME_BLOCK_V = lonarr(num_Blocks) ; FOR i=0, num_Blocks-1 DO BEGIN ; INDEX_BLOCK = ixBlocks[i] ; ;long2struct , vector[INDEX_BLOCK:INDEX_BLOCK+n_elements(struct2long(header.header_sw)-1)] , header.header_sw ; ;Definisce il tipo di Blocco (header, segnale_somma, segnale_guardia, segnale_delta ) ; NAME_BLOCK_V[i] = header.header_sw.header_sw_chank.NOME_1 ; ENDFOR NAME_BLOCK_V = vector[ixBlocks+17] ;Identifico il numero di batch, che corrisponde al numero di header presenti index_hdr = where(NAME_BLOCK_V EQ 1213223748L AND vector[ixBlocks+18] EQ 1313428036L , n_batch) index_hdr_out = where(NAME_BLOCK_V EQ 1213223748L AND vector[ixBlocks+18] EQ 1431261764L , n_hdr_out) IF (n_hdr_out NE 0) then NAME_BLOCK_V[index_hdr_out] = 20000000 index_stt_laa = where(NAME_BLOCK_V EQ 1599362131 AND vector[ixBlocks+18] EQ 4276556L , n_stt) IF (n_stt NE 0) then NAME_BLOCK_V[index_stt_laa] = 30000000 IF n_batch GT 0 then begin ;Identifico il numero di blocchi di segnale presenti per ogni batch num_block_sig_v = shift([index_hdr,num_Blocks],-1) - [index_hdr,num_Blocks] num_block_sig_v = num_block_sig_v[0:n_batch-1] header_v = REPLICATE(header.header_data,n_batch) ; SIG_SUM_I_v = fltarr(NRBIN_v, NPRI_v, n_batch) ; SIG_SUM_Q_v = fltarr(NRBIN_v, NPRI_v, n_batch) ; ; SIG_GUARD_I_v = fltarr(NRBIN_v, NPRI_v, n_batch) ; SIG_GUARD_Q_v = fltarr(NRBIN_v, NPRI_v, n_batch) ; ; SIG_DAZ_I_v = fltarr(NRBIN_v, NPRI_v, n_batch) ; SIG_DAZ_Q_v = fltarr(NRBIN_v, NPRI_v, n_batch) ; ; SIG_DEL_I_v = fltarr(NRBIN_v, NPRI_v, n_batch) ; SIG_DEL_Q_v = fltarr(NRBIN_v, NPRI_v, n_batch) ;Lettura, header e segnali n_batch_read = 0 ant_prec = 0. n_batch_to_read = 2 mismatch_th = 3 max_att = 63.5 cal_noise_batch = 4 cal_inject_batch = 10 ;Batch per calibrazione ;Canali 000-110 canali batch 0 noise 6 inject ;Canali 111-220 canali batch 2 noise 8 inject ;Canali 221-330 canali batch 4 noise 10 inject cal_noise_batch = 1000000 cal_inject_batch = 1000000 ; filename_rec = 'E:\CAL\24_06_21_monopulse.dat' ; openw, lun_m, filename_rec, /get_lun ; printf, lun_m, " BATCH_ID - Somma - DAZ - DEL - U0 - V0 - ANT_AZ - ANT-EL" header_out = list() header_out_gen, header_result STT_HEADER_GEN, LOCAL_A_A_TRACKING_DATA STT_RECORD_GEN, STT_DATA FOR i=n_batch_read, n_batch-n_batch_to_read DO BEGIN ;print, "********************************************" ;print, "batch", i n_ch = 0 signal = !null ; serve x concatenare il vettore segnale canale x canale ;if i EQ 1263 THEN STOP FOR j=0, num_block_sig_v[i]-1 DO BEGIN INDEX_BLOCK = ixBlocks[index_hdr[i]+j] ; ;print, header.header_data.header_info.MARKER_DATI_1, format='(z)' NAME_BLOCK = NAME_BLOCK_V[index_hdr[i]+j] BLOCK_SIZE = vector[INDEX_BLOCK+5]/4L IF BLOCK_SIZE GT 0 THEN $ BLOCK_DATA = vector[INDEX_BLOCK:INDEX_BLOCK+BLOCK_SIZE-1] CASE (NAME_BLOCK) OF ;Marker Header (DSPHDRIN) 1213223748 : BEGIN ;long2struct , vector[INDEX_BLOCK:INDEX_BLOCK+n_elements(struct2long(header)-1)] , header point_lun, lun, INDEX_BLOCK*4L readu, lun, header N_PRI = header.header_data.signal_descr.PACKETDESCR.npri N_RBIN = header.header_data.signal_descr.PACKETDESCR.nrbin DIM_BATCH = N_PRI*N_RBIN HEADER_SIG = header header_v[i] = header.header_data ;header_sig.header_data.GENERAL_SETTINGS.antenna.position.NAVAZ_RAD=header_sig.header_data.GENERAL_SETTINGS.antenna.position.NAVAZ_RAD ;header_sig.header_data.GENERAL_SETTINGS.antenna.position.NAVEL_RAD=header_sig.header_data.GENERAL_SETTINGS.antenna.position.NAVEL_RAD ;header_sig.header_data.GENERAL_SETTINGS.antenna.position.BODYAZ_RAD=header_sig.header_data.GENERAL_SETTINGS.antenna.position.BODYAZ_RAD ;header_sig.header_data.GENERAL_SETTINGS.antenna.position.BODYEL_RAD=header_sig.header_data.GENERAL_SETTINGS.antenna.position.BODYEL_RAD ;header_sig.header_data.GENERAL_SETTINGS.antenna.position.ANTENNAAZ_RAD=header_sig.header_data.GENERAL_SETTINGS.antenna.position.ANTENNAAZ_RAD ;header_sig.header_data.GENERAL_SETTINGS.antenna.position.ANTENNAEL_RAD=header_sig.header_data.GENERAL_SETTINGS.antenna.position.ANTENNAEL_RAD header_out.add, header_sig ;print, "FREQUENZA", header_sig.header_data.function_settings.pe_settings.tx_chan_mhz END ELSE: ENDCASE ENDFOR ; ciclo legato ai blocchi contenuti nel singolo batch ENDFOR ; ciclo legato ai batch ENDIF ELSE BEGIN print, "Nessun Header Trovato" ENDELSE endif close, lun & free_lun, lun endif END