幅度更换为float

pull/13/head
陈增辉 2025-03-28 19:06:59 +08:00
parent 2309c750e7
commit 7f4a8de726
3 changed files with 45 additions and 32 deletions

View File

@ -14,9 +14,13 @@
/* 机器函数 ****************************************************************************************************************************/
extern __device__ double GPU_getSigma0dB(CUDASigmaParam param, double theta) {//ÏßÐÔÖµ
double sigma = param.p1 + param.p2 * exp(-param.p3 * theta) + param.p4 * cos(param.p5 * theta + param.p6);
return sigma;
__device__ double GPU_getSigma0dB(CUDASigmaParam param, double theta)
{
return param.p1 + param.p2 * exp(-param.p3 * theta) + param.p4 * cos(param.p5 * theta + param.p6);
}
extern __device__ float GPU_getSigma0dB(CUDASigmaParam param, float theta) {//ÏßÐÔÖµ
return param.p1 + param.p2 * expf(-param.p3 * theta) + param.p4 * cosf(param.p5 * theta + param.p6);;
}
@ -510,14 +514,19 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
return;
}
else {
RstX = RstX / RstR;
RstY = RstY / RstR;
RstZ = RstZ / RstR;
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) {
double dotAB = RstX * slopeX + RstY * slopeY + RstZ * slopeZ;
double localangle = acos(dotAB / (RstR * slopR));
float dotAB = RstX * slopeX + RstY * slopeY + RstZ * slopeZ;
float localangle = acosf(dotAB / ( slopR));
if (localangle < 0 || localangle >= LAMP_CUDA_PI / 2 || isnan(localangle)) {
d_temp_R[idx] = 0;
@ -529,19 +538,24 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
// 计算斜距衰减
double antDirectR = sqrt(antp.antDirectX * antp.antDirectX
float antDirectR = sqrtf(antp.antDirectX * antp.antDirectX
+ antp.antDirectY * antp.antDirectY
+ antp.antDirectZ * antp.antDirectZ);
double diectAngle = -1*(RstX*antp.antDirectX+
float diectAngle = -1*(RstX*antp.antDirectX+
RstY*antp.antDirectY+
RstZ*antp.antDirectZ) / (antDirectR* RstR);
RstZ*antp.antDirectZ) / (antDirectR );
diectAngle = acosf(diectAngle);// 弧度制
//if (diectAngle * r2d <3) {
// printf("idx: %d, antAngle : %e \n", prfId, diectAngle * r2d);
//}
diectAngle = diectAngle * GainWeight;
double ampGain = 2 * maxGain * (1 - (diectAngle * diectAngle / 6)
float ampGain = 2 * maxGain * (1 - (diectAngle * diectAngle / 6)
+ (diectAngle * diectAngle * diectAngle * diectAngle / 120)
- (diectAngle * diectAngle * diectAngle * diectAngle * diectAngle * diectAngle / 5040));
- (diectAngle * diectAngle * diectAngle * diectAngle * diectAngle * diectAngle / 5040)); //dB
ampGain = powf(10.0, ampGain / 10.0);
ampGain = ampGain / (powf(4 * LAMP_CUDA_PI, 2) * powf(RstR, 4)); // 反射强度
double sigma = GPU_getSigma0dB(sigma0Params, localangle);
@ -552,12 +566,9 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
bool isNan = !(isnan(temp_amp) || isnan(temp_R) || isinf(temp_amp) || isinf(temp_R));
d_temp_amps[idx] = temp_amp * isNan;
d_temp_R[idx] = temp_R * isNan;
return;
}
}

View File

@ -33,12 +33,12 @@ extern "C" struct GoalState {
extern "C" struct CUDASigmaParam {
double p1;
double p2;
double p3;
double p4;
double p5;
double p6;
float p1;
float p2;
float p3;
float p4;
float p5;
float p6;
};
extern "C" struct SloperDs
@ -91,7 +91,7 @@ extern "C" struct RFPCTask
cuComplex* d_echoData = nullptr; // »Ø²¨
CUDASigmaParam sigma0_cls;
double maxGain=48;
double GainWeight=300;
double GainWeight=20; // 2¶È·¶Î§
size_t targetnum;
@ -103,6 +103,8 @@ extern __device__ double GPU_getSigma0dB_params(
double theta);
extern __device__ double GPU_getSigma0dB(CUDASigmaParam param, double theta);
extern __device__ float GPU_getSigma0dB(CUDASigmaParam param, float theta);
extern __device__ CUDAVectorEllipsoidal GPU_SatelliteAntDirectNormal(
double RstX, double RstY, double RstZ,

View File

@ -971,20 +971,20 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si
for (const auto& pair : clssigmaParamsDict) {
clsCUDASigmaParamsDict.insert(std::pair<long, CUDASigmaParam>(pair.first,
CUDASigmaParam{
pair.second.p1,
pair.second.p2,
pair.second.p3,
pair.second.p4,
pair.second.p5,
pair.second.p6
float(pair.second.p1),
float(pair.second.p2),
float(pair.second.p3),
float(pair.second.p4),
float(pair.second.p5),
float(pair.second.p6)
}));
printf("clsid:%d, params: %e,%e,%e,%e,%e,%e \n", pair.first,
pair.second.p1,
pair.second.p2,
pair.second.p3,
pair.second.p4,
pair.second.p5,
pair.second.p6
float(pair.second.p1),
float(pair.second.p2),
float(pair.second.p3),
float(pair.second.p4),
float(pair.second.p5),
float(pair.second.p6)
);
}