增加了模拟天线方向图衰减

pull/13/head
陈增辉 2025-03-26 00:27:22 +08:00
parent ab8ca4802f
commit 3bf201b4ca
3 changed files with 62 additions and 20 deletions

View File

@ -466,8 +466,15 @@ void CUDA_RFPC_MainProcess(
/* 核函数 ****************************************************************************************************************************/
__device__ double SincTarg(double x) {
return 1 - (pow(x, 2) / 6) + (pow(x, 4) / 120) - (pow(x, 6) / 5040);
}
__global__ void Kernel_Computer_R_amp_NoAntPattern(
SateState* antlist,
long PRFCount,
@ -478,6 +485,7 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
double Pt,
double refPhaseRange,
double NearR, double FarR,
double maxGain,double GainWeight,
double* d_temp_R, double* d_temp_amps// 计算输出
) {
long long idx = blockIdx.x * blockDim.x + threadIdx.x; // 获取当前的线程编码
@ -489,18 +497,14 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
//}
if (prfId < PRFCount && posId < pixelcount) {
double RstX = antlist[prfId].Px - goallist[posId].Tx; // ¼ÆËã×ø±êʸÁ¿
double RstY = antlist[prfId].Py - goallist[posId].Ty;
double RstZ = antlist[prfId].Pz - goallist[posId].Tz;
SateState antp = antlist[prfId];
GoalState gp = goallist[posId];
double RstX = antp.Px - gp.Tx; // 柴麻恫炎文楚 T->S
double RstY = antp.Py - gp.Ty;
double RstZ = antp.Pz - gp.Tz;
double RstR = sqrt(RstX * RstX + RstY * RstY + RstZ * RstZ); // 矢量距离
//if (prfId > 20000) {
// printf("prfid %d,nearR R Rfar %e %e %e ant=[%e,%e,%e] dem_G=[%e,%e,%e]\n", prfId,NearR,RstR,FarR,
// antlist[prfId].Px , antlist[prfId].Py , antlist[prfId].Pz ,
// goallist[posId].Tx, goallist[posId].Ty, goallist[posId].Tz
// );
//}
if (RstR<NearR || RstR>FarR) {
d_temp_R[idx] = 0;
@ -508,9 +512,9 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
return;
}
else {
double slopeX = goallist[posId].TsX;
double slopeY = goallist[posId].TsY;
double slopeZ = goallist[posId].TsZ;
double slopeX = gp.TsX;
double slopeY = gp.TsY;
double slopeZ = gp.TsZ;
double slopR = sqrtf(slopeX * slopeX + slopeY * slopeY + slopeZ * slopeZ); //
if (abs(slopR - 0) > 1e-3) {
@ -524,7 +528,20 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
}
else {}
double ampGain = 1;
// 柴麻弍鉦縫受
double antDirectR = sqrt(antp.antDirectX * antp.antDirectX
+ antp.antDirectY * antp.antDirectY
+ antp.antDirectZ * antp.antDirectZ);
double diectAngle = -1*(RstX*antp.antDirectX+
RstY*antp.antDirectY+
RstZ*antp.antDirectZ) / (antDirectR* RstR);
diectAngle = acos(diectAngle);// 察業崙
double ampGain = 2*maxGain*SincTarg(GainWeight*diectAngle);
ampGain = ampGain / (powf(4 * LAMP_CUDA_PI, 2) * powf(RstR, 4)); // 反射强度
double sigma = GPU_getSigma0dB(sigma0Params, localangle);
sigma = powf(10.0, sigma / 10.0);
@ -549,6 +566,11 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
__global__ void CUDA_Kernel_Computer_echo_NoAntPattern(
double* d_temp_R, double* d_temp_amps, long posNum,
double f0, double dfreq,
@ -586,9 +608,6 @@ __global__ void CUDA_Kernel_Computer_echo_NoAntPattern(
if (fId < maxfreqnum && prfId < temp_PRF_Count) {
long echo_ID = prfId * maxfreqnum + fId; // 计算对应的回波位置
float factorjTemp = RFPCPIDIVLIGHT * (f0 + fId * dfreq);
cuComplex echo = make_cuComplex(0, 0);
@ -735,6 +754,7 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid)
task.Pt,
task.Rref,
task.Rnear, task.Rfar,
task.maxGain,task.GainWeight,
d_R, d_amps// 计算输出
);
PrintLasterError("CUDA_Kernel_Computer_R_amp");

View File

@ -17,6 +17,10 @@
extern "C" struct SateState {
double Px, Py, Pz, Vx, Vy, Vz;
//double antXaxisX, antXaxisY, antXaxisZ;
//double antYaxisX, antYaxisY, antYaxisZ;
//double antZaxisX, antZaxisY, antZaxisZ;
double antDirectX, antDirectY, antDirectZ;
};
@ -86,7 +90,8 @@ extern "C" struct RFPCTask
GoalState* goallist = nullptr;
cuComplex* d_echoData = nullptr; // ťŘ˛¨
CUDASigmaParam sigma0_cls;
double maxGain=48;
double GainWeight=300;
size_t targetnum;

View File

@ -929,8 +929,8 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU() {
ErrorCode RFPCProcessCls::RFPCMainProcess_MultiGPU_NoAntPattern()
{
int num_devices=1;
//cudaGetDeviceCount(&num_devices);
int num_devices=0;
cudaGetDeviceCount(&num_devices);
PRINT("GPU Count : %d \n", num_devices);
long prfcount = this->EchoSimulationData->getPluseCount();
@ -1089,6 +1089,23 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si
h_antlist.get()[i].Vx = antplise.get()[i + startprfid].Vx;
h_antlist.get()[i].Vy = antplise.get()[i + startprfid].Vy;
h_antlist.get()[i].Vz = antplise.get()[i + startprfid].Vz;
h_antlist.get()[i].antDirectX = antplise.get()[i + startprfid].AntDirectX;
h_antlist.get()[i].antDirectY = antplise.get()[i + startprfid].AntDirectY;
h_antlist.get()[i].antDirectZ = antplise.get()[i + startprfid].AntDirectZ;
h_antlist.get()[i].antXaxisX = antplise.get()[i + startprfid].x;
h_antlist.get()[i].Vz = antplise.get()[i + startprfid].Vz;
h_antlist.get()[i].Vz = antplise.get()[i + startprfid].Vz;
h_antlist.get()[i].Vz = antplise.get()[i + startprfid].Vz;
h_antlist.get()[i].Vz = antplise.get()[i + startprfid].Vz;
h_antlist.get()[i].Vz = antplise.get()[i + startprfid].Vz;
h_antlist.get()[i].Vz = antplise.get()[i + startprfid].Vz;
h_antlist.get()[i].Vz = antplise.get()[i + startprfid].Vz;
}
task.antlist = (SateState*)mallocCUDADevice(prfcount * sizeof(SateState), devId);