def message1120(data_1120): #id # print(mesid(data_1120[4:6])) #剔除前28个字节和crc del data_1120[0:28] del data_1120[-4:] pd_1120 = pd.DataFrame(columns = ['SatId','FNAVReceived','INAVReceived','E1BHealth','E5aHealth','E5bHealth','Reserved', 'IODa','Weeks','Seconds','Ecc','OmegaDot','Omega0','Omega','M0','Af0','Af1','DeltaRootA','DeltaI']) cut_1120 = np.array([4,4,4,1,1,1,1,4,4,4,8,8,8,8,8,8,8,8,8]) #转成2进制数bin_1120 bin_1120=[] for ind, line in enumerate(data_1120): bin_line = '{:08b}'.format(int(line,16)) bin_1120.append(bin_line) for ind, line in enumerate(data_1120): list_tmp = [] for i, ele in enumerate(cut_1120): ind_start = sum(cut_1120[0:i]) ind_end = sum(cut_1120[0:(i+1)]) if ind_start == 24: data_bin= bin_1120[ind_start:ind_end] data_bin = ''.join(data_bin) data_int = type2int(data_bin,1) else: data_bin= bin_1120[ind_start:ind_end] data_bin = ''.join(data_bin) data_int = type2int(data_bin,2) list_tmp.append(data_int) # print(list_tmp) pd_1120.loc[ind] = np.array(list_tmp) # print(pd_1120) pd_1120.to_csv('1120.csv') return pd_1120
def message1584(data_3006): #剔除前28个字节和crc del data_3006[0:28] del data_3006[-4:] # print(data_3006) pd_3006 = pd.DataFrame(columns = ['satellite ID','week','toa','RootA','ecc','ω','M0','Ω','0_Ω','δi','a0','a1','health']) cut_3006 = np.array([4,4,4,8,8,8,8,8,8,8,8,8,4]) # print(cut_3006) # print(data_3006) #转成2进制数bin_3006 bin_3006=[] for ind, line in enumerate(data_3006): bin_line = '{:08b}'.format(int(line,16)) bin_3006.append(bin_line) for ind, line in enumerate(data_3006): list_tmp = [] for i, ele in enumerate(cut_3006): ind_start = sum(cut_3006[0:i]) ind_end = sum(cut_3006[0:(i+1)]) data_bin= bin_3006[ind_start:ind_end] data_bin = ''.join(data_bin) data_int = type2int(data_bin,2) list_tmp.append(data_int) # print(list_tmp) pd_3006.loc[ind] = np.array(list_tmp) result_3006=pd_3006.to_csv('1584.csv') return pd_3006
def message1122(data_1122): #id print(mesid(data_1122[4:6])) #剔除前28个字节和crc del data_1122[0:28] del data_1122[-4:] # print(data_1122) pd_1122 = pd.DataFrame(columns = ['SatId','FNAVReceived','INAVReceived','E1BHealth','E5aHealth','E5bHealth','E1BDVS','E5aDVS','E5bDVS', 'SISA','Reserved','IODNav','T0e','RootA','DeltaN','M0','Ecc','Omega','Cuc','Cus','Crc','Crs','Cic','Cis','I0','IDot','Omega0', 'OmegaDot','FNAVT0c','FNAVAf0','FNAVAf1','FNAVAf2','INAVT0c','INAVAf0','INAVAf1','INAVAf2','E1E5aBGD','E1E5bBGD']) cut_1122 = np.array([4,4,4,1,1,1,1,1,1,1,1,4,4,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,4,8,8,8,4,8,8,8,8,8]) #转成2进制数bin_1122 bin_1122=[] for ind, line in enumerate(data_1122): bin_line = '{:08b}'.format(int(line,16)) bin_1122.append(bin_line) for ind, line in enumerate(data_1122): list_tmp = [] for i, ele in enumerate(cut_1122): ind_start = sum(cut_1122[0:i]) ind_end = sum(cut_1122[0:(i+1)]) data_bin= bin_1122[ind_start:ind_end] data_bin = ''.join(data_bin) data_int = type2int(data_bin,2) list_tmp.append(data_int) # print(list_tmp) pd_1122.loc[ind] = np.array(list_tmp) pd_1122.to_csv('1122.csv') return pd_1122
def message1696(data_1696): #id print(mesid(data_1696[4:6])) #剔除前28个字节和crc del data_1696[0:28] del data_1696[-4:] pd_1696 = pd.DataFrame(columns = ['satellite ID','Week','URA','health 1','tgd1','tgd2','AODC','toc','a0','a1', 'a2','AODE','toe','RootA','ecc','ω','ΔN','M0','Ω0','0_Ω','i0','IDOT','c_uc','c_us','c_rc','c_rs', 'c_ic','c_is']) cut_1696 = np.array([4,4,8,4,8,8,4,4,8,8,8,4,4,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]) # print(cut_1696) # print(data_1696) #转成2进制数bin_1696 bin_1696=[] for ind, line in enumerate(data_1696): bin_line = '{:08b}'.format(int(line,16)) bin_1696.append(bin_line) for ind, line in enumerate(data_1696): list_tmp = [] for i, ele in enumerate(cut_1696): ind_start = sum(cut_1696[0:i]) ind_end = sum(cut_1696[0:(i+1)]) data_bin= bin_1696[ind_start:ind_end] data_bin = ''.join(data_bin) data_int = type2int(data_bin,2) list_tmp.append(data_int) pd_1696.loc[ind] = np.array(list_tmp) pd_1696.loc[ind] = np.array(list_tmp) # print(pd_1696.head(5)) pd_1696.to_csv('1696.csv') return pd_1696
def message73(data_4900): print(mesid(data_4900[4:6])) c=mesid(data_4900[28:32]) #剔除前32个字节和crc del data_4900[0:32] del data_4900[-4:] # print(data_4900) #转成2进制数bin_d302 bin_4900=[] for ind, line in enumerate(data_4900): bin_line = '{:08b}'.format(int(line,16)) bin_4900.append(bin_line) # print(bin_4900) #分段 div4900=div_raw(bin_4900,c) pd_div4900 = pd.DataFrame(columns =['GPRN','week','seconds','ecc','0_omega','omega_0','omega','Mo','afo', 'af1','N','A','ncl-angle','SV config','health-prn','health-alm','antispoof']) cut_div4900 = np.array([4,4,8,8,8,8,8,8,8,8,8,8,8,4,4,4,4]) for j,e in enumerate(div4900): for ind, line in enumerate(div4900[j]): list_tmp = [] for i, ele in enumerate(cut_div4900): ind_start = sum(cut_div4900[0:i]) ind_end = sum(cut_div4900[0:(i+1)]) data_bin= div4900[j][ind_start:ind_end] data_bin = ''.join(data_bin) data_int = type2int(data_bin,2) list_tmp.append(data_int) pd_div4900.loc[j] = np.array(list_tmp) # print(pd_div4900) pd_div4900.to_csv('73.csv') return pd_div4900
def message41(data_41): def cplmcode(a): if a[0]=='1': tmp = -(2**(len(a[1:]))-int(a[1:],2)) else: tmp = int(a,2) return tmp print(mesid(data_41[4:6])) # 剔除前28个字节和crc del data_41[0:28] del data_41[-4:] # print(data_41) pd_41 = pd.DataFrame(columns=['prn', 'ref week', 'ref secs','code_on','week_No','p_flag','SV_acc','SV_hl','Tgd','IODC','toc','af2','af1','af0','IODE','Cts','delta_n','M0','Cuc','e','Cus','sq_A','toe','Cic','Omega0','Cis','i0','Ctc','w','Omega_dot','IDOT']) cut_41 = np.array([4, 4, 4]) # print(cut_41) # print(data_41) # 转成2进制数bin_41 bin_41 = [] for ind, line in enumerate(data_41): bin_line = '{:08b}'.format(int(line, 16)) bin_41.append(bin_line) # 数据处理 for ind, line in enumerate(data_41): list_tmp = [] for i, ele in enumerate(cut_41): ind_start = sum(cut_41[0:i]) ind_end = sum(cut_41[0:(i + 1)]) data_bin = bin_41[ind_start:ind_end] data_bin = ''.join(data_bin) data_int = type2int(data_bin, 2) list_tmp.append(data_int) #选出子帧 del data_41[0:40] del data_41[-4:] # print(data_41) #子帧1 tmp1 = bin_41[0:30] subf1 = ''.join(tmp1) #子帧2 tmp2 = bin_41[30:60] subf2 = ''.join(tmp2) #子帧3 tmp3 = bin_41[60:90] subf3 = ''.join(tmp3) #数据处理 #子帧1参数 code_on = subf1[58:60] week_No = int(subf1[24:41],2) * 4 p_flag = subf1[72] SV_acc = subf1[60:64] SV_hl = subf1[64:70] Tgd = cplmcode(subf1[160:168]) / (2**31) IODC = subf1[70:72] + subf1[168:168+8] toc = int(subf1[176:176+16],2) * (2**4) af2 = cplmcode(subf1[192:200]) / (2**55) af1 = cplmcode(subf1[200:216]) / (2**43) af0 = cplmcode(subf1[216:238]) / (2**31) #子帧2,3参数 IODE = subf2[48:56] Cts = cplmcode(subf2[56:56+16]) / (2**5) delta_n = cplmcode(subf2[72:72+16]) / (2**43) M0 = cplmcode(subf2[88:88+8] + subf2[96:96+24]) / (2**31) Cuc = cplmcode(subf2[120:136]) / (2**29) e = int(subf2[136:136+8] + subf2[144:144+24],2) / (2**33) Cus = cplmcode(subf2[168:168+16]) / (2**29) sq_A = int(subf2[184:184+8] + subf2[192:192+24],2) / (2**19) toe = int(subf2[216:216+16],2) * (2**4) Cic = cplmcode(subf3[48:48+16]) / (2**29) Omega0 = cplmcode(subf3[64:64+32]) / (2**31) Cis = cplmcode(subf3[96:96+16]) / (2**29) i0 = cplmcode(subf3[112:112+32]) /(2**31) Ctc = cplmcode(subf3[144:144+16]) / (2**5) w = cplmcode(subf3[160:160+32]) /(2**31) Omega_dot = cplmcode(subf3[192:192+24]) / (2**43) IDOT = cplmcode(subf3[224:224+14]) / (2**43) tmp_41 = [code_on, week_No, p_flag, SV_acc, SV_hl, Tgd, IODC, toc, af2, af1, af0, IODE, Cts, delta_n, M0, Cuc, e, Cus, sq_A, toe, Cic, Omega0, Cis, i0, Ctc, w, Omega_dot, IDOT] list_tmp.extend(tmp_41) pd_41.loc[ind] = np.array(list_tmp) # print(pd_41) pd_41.to_csv('41.csv') return pd_41