修复天线方向图插值bug

pull/3/head
陈增辉 2025-01-28 11:01:01 +08:00
parent aca14ee0cc
commit a18b7f4baa
1 changed files with 8 additions and 20 deletions

View File

@ -27,10 +27,10 @@ __device__ double GPU_getSigma0dB(CUDASigmaParam param, double theta) {//
__device__ CUDAVectorEllipsoidal GPU_SatelliteAntDirectNormal( __device__ CUDAVectorEllipsoidal GPU_SatelliteAntDirectNormal(
double RstX, double RstY, double RstZ, double RstX, double RstY, double RstZ,
double antXaxisX, double antXaxisY, double antXaxisZ, double AntXaxisX, double AntXaxisY, double AntXaxisZ,
double antYaxisX, double antYaxisY, double antYaxisZ, double AntYaxisX, double AntYaxisY, double AntYaxisZ,
double antZaxisX, double antZaxisY, double antZaxisZ, double AntZaxisX, double AntZaxisY, double AntZaxisZ,
double antDirectX, double antDirectY, double antDirectZ double AntDirectX, double AntDirectY, double AntDirectZ
) { ) {
CUDAVectorEllipsoidal result{ 0,0,-1 }; CUDAVectorEllipsoidal result{ 0,0,-1 };
@ -38,15 +38,6 @@ __device__ CUDAVectorEllipsoidal GPU_SatelliteAntDirectNormal(
double Xst = -1 * RstX; // 卫星 --> 地面 double Xst = -1 * RstX; // 卫星 --> 地面
double Yst = -1 * RstY; double Yst = -1 * RstY;
double Zst = -1 * RstZ; double Zst = -1 * RstZ;
double AntXaxisX = antXaxisX;
double AntXaxisY = antXaxisY;
double AntXaxisZ = antXaxisZ;
double AntYaxisX = antYaxisX;
double AntYaxisY = antYaxisY;
double AntYaxisZ = antYaxisZ;
double AntZaxisX = antZaxisX;
double AntZaxisY = antZaxisY;
double AntZaxisZ = antZaxisZ;
// 归一化 // 归一化
double RstNorm = sqrtf(Xst * Xst + Yst * Yst + Zst * Zst); double RstNorm = sqrtf(Xst * Xst + Yst * Yst + Zst * Zst);
@ -73,15 +64,12 @@ __device__ CUDAVectorEllipsoidal GPU_SatelliteAntDirectNormal(
double Zant = (Rx * Xy * Yz - Rx * Xz * Yy - Ry * Xx * Yz + Ry * Xz * Yx + Rz * Xx * Yy - Rz * Xy * Yx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx); double Zant = (Rx * Xy * Yz - Rx * Xz * Yy - Ry * Xx * Yz + Ry * Xz * Yx + Rz * Xx * Yy - Rz * Xy * Yx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx);
// 计算theta 与 phi // 计算theta 与 phi
double Norm = sqrtf(Xant * Xant + Yant * Yant + Zant * Zant); // 计算 pho double Norm = sqrtf(Xant * Xant + Yant * Yant + Zant * Zant); // 计算 pho
double ThetaAnt = abs(Zant - Norm)<PRECISIONTOLERANCE?0: acosf(Zant / Norm); // theta Óë ZÖáµÄ¼Ð½Ç double Zn = Zant / Norm;
double PhiAnt = atanf(Yant / Xant); // -pi/2 ~pi/2 double ThetaAnt = ( - 1 > Zn) ? PI : (Zn > 1 ? 0 : acos(Zn));// acosf(Zant / Norm); // theta Óë ZÖáµÄ¼Ð½Ç
double PhiAnt = abs(Xant)<PRECISIONTOLERANCE ?0: atanf(Yant / Xant); // -pi/2 ~pi/2
if (isnan(ThetaAnt)) {
printf("theta is nan,[Xant,Yant,Zant,Norm,Zn,Z1]=[%f,%f,%f,%f,%f,%f];\n",
Xant, Yant, Zant,Norm, Zant / Norm, Zant / Norm-1);
}
if (abs(Yant) < PRECISIONTOLERANCE) { // X轴上 if (abs(Yant) < PRECISIONTOLERANCE) { // X轴上
PhiAnt = 0; PhiAnt = 0;