2、输入点迹、输出航迹的CPI时间和GNSS时间都改为64位整型; 3、修复TAS外推时间差计算可能为无效值的问题; Signed-off-by: waiwaylee <waiwaylee@foxmail.com>
304 lines
9.2 KiB
C++
304 lines
9.2 KiB
C++
#include "data_process.h"
|
|
#include "memory.h"
|
|
#include <QVector>
|
|
#include <qmath.h>
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
/*******************************************************************************/
|
|
/*******************************************************************************/
|
|
/************************************用户接口函数*******************************/
|
|
/*******************************************************************************/
|
|
/*******************************************************************************/
|
|
|
|
|
|
//数据预处理
|
|
int Data_Process::data_preprocess(struct DataRev Data_Input[150])
|
|
{
|
|
// 更新当前系统时间
|
|
latest_timestamp = Data_Input[0].CPI_time;
|
|
|
|
//数据存入缓存区域 Data_buffer
|
|
if(Data_Input[0].point_type == 0) //tws数据
|
|
{
|
|
data_num=min(Data_Input[0].Point_Sum, 150);
|
|
//qDebug() << "TARGET azi beam idx:" <<Data_Input[0].Beam_index_aiz;
|
|
for (int i=0; i<data_num;i++)
|
|
{
|
|
PointRecv Data_buffer_temp;
|
|
Data_buffer_temp.Amplitude=Data_Input[i].Amplitude;
|
|
Data_buffer_temp.Azimuth=Data_Input[i].Azimuth/180*PI;
|
|
Data_buffer_temp.snr = Data_Input[i].Snr;
|
|
Data_buffer_temp.RCS = Data_Input[i].RCS;
|
|
Data_buffer_temp.CPI_Time = Data_Input[i].CPI_time;
|
|
Data_buffer_temp.GNSS_time = Data_Input[i].GNSS_time;
|
|
Data_buffer_temp.Freq_index = Data_Input[i].Freq_index;
|
|
Data_buffer_temp.PRF_index = Data_Input[i].PRI;
|
|
Data_buffer_temp.Range = Data_Input[i].Range;
|
|
Data_buffer_temp.Height= Data_Input[i].Range*sin(Data_Input[i].Elevation/180*PI);
|
|
Data_buffer_temp.Use_Flag = 0;
|
|
Data_buffer_temp.Velocity = Data_Input[i].Velocity;
|
|
|
|
Data_buffer_temp.pitch_num = Data_Input[i].pitch_num;
|
|
|
|
std::memcpy(Data_buffer_temp.speed_dim, Data_Input[i].speed_dim, sizeof(Data_buffer_temp.speed_dim));
|
|
std::memcpy(Data_buffer_temp.range_dim, Data_Input[i].range_dim, sizeof(Data_buffer_temp.range_dim));
|
|
|
|
Data_buffer.push_back(Data_buffer_temp);
|
|
}
|
|
if(Data_Input[0].Beam_index_aiz < last_beam_num) //TWS
|
|
{
|
|
last_beam_num = Data_Input[0].Beam_index_aiz;
|
|
|
|
return 1;
|
|
}
|
|
else
|
|
{
|
|
last_beam_num = Data_Input[0].Beam_index_aiz;
|
|
return 2;
|
|
}
|
|
}
|
|
|
|
else if(Data_Input[0].point_type == 1) //tas数据
|
|
{
|
|
// qDebug() << "TAS TARGET :" <<Data_Input[0].TAS_track_index;
|
|
//qDebug() << "TAS time :" <<Data_Input[0].CPI_time;
|
|
|
|
data_num=Data_Input[0].Point_Sum;
|
|
TAS_track_idx = Data_Input[0].TAS_track_index;
|
|
latest_timestamp = Data_Input[0].CPI_time;
|
|
for (int i=0; i<data_num;i++)
|
|
{
|
|
PointRecv Data_buffer_temp;
|
|
Data_buffer_temp.Amplitude=Data_Input[i].Amplitude;
|
|
Data_buffer_temp.Azimuth=Data_Input[i].Azimuth/180*PI;
|
|
Data_buffer_temp.snr = Data_Input[i].Snr;
|
|
Data_buffer_temp.RCS = Data_Input[i].RCS;
|
|
Data_buffer_temp.CPI_Time = Data_Input[i].CPI_time;
|
|
Data_buffer_temp.GNSS_time = Data_Input[i].GNSS_time;
|
|
Data_buffer_temp.Freq_index = Data_Input[i].Freq_index;
|
|
Data_buffer_temp.PRF_index = Data_Input[i].PRI;
|
|
Data_buffer_temp.Range = Data_Input[i].Range;
|
|
Data_buffer_temp.Height= Data_Input[i].Range*sin(Data_Input[i].Elevation/180*PI);
|
|
Data_buffer_temp.Use_Flag = 0;
|
|
Data_buffer_temp.Velocity = Data_Input[i].Velocity;
|
|
Data_buffer_temp.pitch_num = Data_Input[i].pitch_num;
|
|
std::memcpy(Data_buffer_temp.speed_dim, Data_Input[i].speed_dim, sizeof(Data_buffer_temp.speed_dim));
|
|
std::memcpy(Data_buffer_temp.range_dim, Data_Input[i].range_dim, sizeof(Data_buffer_temp.range_dim));
|
|
|
|
Data_buffer_tas.push_back(Data_buffer_temp);
|
|
|
|
// qDebug() << "Azimuth:" << Data_Input[i].Azimuth
|
|
// << "Range:" << Data_Input[i].Range
|
|
// << "EL:" << Data_Input[i].Elevation
|
|
// << "CPI_Time"<< Data_Input[i].CPI_time
|
|
// << "data_num:" << data_num;
|
|
|
|
}
|
|
|
|
return 3;
|
|
}
|
|
|
|
else
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//数据处理
|
|
int Data_Process::track_process(struct Track Trust_Track_Output[MAX_TRACK_NUM][10],
|
|
int *Trust_track_num_Output,
|
|
int Track_die_Index_Output[],
|
|
int *Track_die_num_Output,
|
|
int model)
|
|
{
|
|
|
|
//TWS处理
|
|
if(model==2)
|
|
{
|
|
|
|
dot_coh.dot_coh_process_buff(&Data_buffer,&point_recv,Work_Parameter);
|
|
//qDebug() << "point_recv :" <<point_recv.size();
|
|
QVector<PointRecv>().swap(Data_buffer);
|
|
}
|
|
|
|
|
|
|
|
if(model==1)
|
|
{
|
|
*Trust_track_num_Output=0; //航迹更新数
|
|
*Track_die_num_Output=0; //航迹消亡数目
|
|
|
|
track_asso.track_asso_process(&point_recv,
|
|
&trust_track,
|
|
Trust_Track_Output,
|
|
Trust_track_num_Output,
|
|
Work_Parameter
|
|
);
|
|
|
|
track_die.track_die_process( &trust_track,
|
|
Track_die_Index_Output,
|
|
Track_die_num_Output);
|
|
|
|
track_init.track_init_process_logic( &point_recv,
|
|
&trust_track,
|
|
&temp_track,
|
|
Trust_Track_Output,
|
|
Trust_track_num_Output,
|
|
Work_Parameter);
|
|
// qDebug() << "point_recv: " <<point_recv.size();
|
|
// qDebug() << "trust_track: " <<trust_track.size();
|
|
// qDebug() << "temp_track: " <<temp_track.size();
|
|
// qDebug() << "Trust_track_num_Output: " <<*Trust_track_num_Output;
|
|
// qDebug() << "Track_die_num_Output: " <<*Track_die_num_Output;
|
|
|
|
}
|
|
|
|
// TAS处理
|
|
if(model==3)
|
|
{
|
|
*Trust_track_num_Output=0; //航迹更新数
|
|
*Track_die_num_Output=0; //航迹消亡数目
|
|
|
|
dot_coh_tas.dot_coh_tas_process(&Data_buffer_tas,&point_recv_tas); //点迹凝聚
|
|
|
|
// if(point_recv_tas.size()>0)
|
|
// {
|
|
// qDebug() << "point_recv_tas :" <<point_recv_tas[0].Azimuth/PI*180<<" "<<point_recv_tas[0].Range;
|
|
// }
|
|
//qDebug() << "TAS process :" << TAS_track_idx << "p a r:"<<point_recv_tas[0].Point_Sum<<" " <<point_recv_tas[0].Azimuth/PI*180<<" "<<point_recv_tas[0].Range;
|
|
|
|
QVector<PointRecv>().swap(Data_buffer_tas);//凝聚完毕 清除Data_buffer
|
|
|
|
track_asso_tas.track_asso_process_tas(&point_recv_tas, //点迹文件
|
|
&trust_track, //航迹文件
|
|
Trust_Track_Output, //更新航迹信息
|
|
Trust_track_num_Output, //更新航迹数
|
|
Work_Parameter, //工作参数
|
|
TAS_track_idx,
|
|
latest_timestamp //最新时间戳
|
|
);
|
|
|
|
|
|
QVector<PointRecv>().swap(point_recv_tas); //清除 point_recv_tas
|
|
|
|
track_die_tas.track_die_process_tas( &trust_track,
|
|
Track_die_Index_Output,
|
|
Track_die_num_Output);
|
|
|
|
|
|
//qDebug() << "Extrapolate_round :" << trust_track[TAS_track_idx].Extrapolate_round;
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
//波束控制
|
|
void Data_Process::Beam_Ctrl(struct TrackingBeam *Tracking_beam,
|
|
struct Track Trust_Track_Output[][10],
|
|
int *Trust_track_num_Output)
|
|
{
|
|
|
|
tas_ctrl.tas_ctrl_process(&trust_track,Tracking_beam, Trust_Track_Output, Trust_track_num_Output,Work_Parameter, latest_timestamp);
|
|
}
|
|
|
|
//数据处理参数初始化
|
|
int Data_Process::track_process_parameters_initial(struct RadarPara Radar_Parameter)
|
|
{
|
|
|
|
//工作参数设置
|
|
memcpy(&Work_Parameter, &Radar_Parameter, sizeof(RadarPara));
|
|
|
|
return 0;
|
|
}
|
|
|
|
//数据处理参数修改
|
|
int Data_Process::track_process_parameters_modify(struct RadarPara Radar_Parameter)
|
|
{
|
|
memcpy(&Work_Parameter, &Radar_Parameter, sizeof(RadarPara));
|
|
return 0;
|
|
}
|
|
|
|
|
|
//航迹清空函数
|
|
int Data_Process::track_clear_all(void)
|
|
{
|
|
//清空可靠航迹
|
|
Data_buffer.clear();
|
|
Data_buffer_tas.clear();
|
|
point_recv.clear();
|
|
point_recv_tas.clear();
|
|
trust_track.clear();
|
|
temp_track.clear();
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
//手动航迹删除函数
|
|
int Data_Process:: track_delete(int delete_track_num, //手动删除的航迹数目
|
|
int delete_track_index[]) //手动删除的航迹号
|
|
{
|
|
for (int i=0;i<delete_track_num ;i++)
|
|
{
|
|
for (int j=0;j<trust_track.size();j++)
|
|
{
|
|
if(trust_track[j].Track_Index == delete_track_index[i])
|
|
{
|
|
|
|
trust_track[j].manual_delete_flag=1;
|
|
qDebug() << "Delete :" << trust_track[j].Track_Index;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
//手动转TAS跟踪函数
|
|
int Data_Process:: tracking_start(int track_index) //需要手动转入TAS跟踪的航迹号
|
|
{
|
|
|
|
for ( int i=0; i<trust_track.size();i++)
|
|
if(trust_track[i].Track_Index==track_index)
|
|
{
|
|
trust_track[i].manual_tracking_flag = 1;
|
|
}
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
//手动取消TAS跟踪函数
|
|
int Data_Process:: tracking_stop(int track_index) //需要手动转入TAS跟踪的航迹号
|
|
{
|
|
|
|
for ( int i=0; i<trust_track.size();i++){
|
|
if(trust_track[i].Track_Index==track_index)
|
|
{
|
|
trust_track[i].manual_tracking_flag = 0;
|
|
trust_track[i].Track_Mode = 0;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
//手动打跟踪波束
|
|
int Data_Process::tracking_point(float Azimuth)//方位角
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|