From 300a7e805581c0549dc567fa28744f6c13ea8c76 Mon Sep 17 00:00:00 2001 From: "DESKTOP-450PEFP\\mainc" Date: Wed, 1 Apr 2026 18:01:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=9B=E5=8D=9A=E5=A3=AB=E8=AE=A9=E6=94=B9?= =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...dules_native_jni_EnergySpectrumHandler.cpp | 105 ++++++++++++++++-- 1 file changed, 96 insertions(+), 9 deletions(-) diff --git a/org_jeecg_modules_native_jni_EnergySpectrumHandler.cpp b/org_jeecg_modules_native_jni_EnergySpectrumHandler.cpp index 26a905f..b2c24a5 100644 --- a/org_jeecg_modules_native_jni_EnergySpectrumHandler.cpp +++ b/org_jeecg_modules_native_jni_EnergySpectrumHandler.cpp @@ -1579,7 +1579,7 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl // variant = message.GetBlockData(order); // if (!variant.isValid()) // { -//// printf((order.toStdString() + " get failed\n").c_str()); +// printf((order.toStdString() + " get failed\n").c_str()); // Histogramflag = true; // } // else @@ -4713,15 +4713,50 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl JNIEXPORT void JNICALL test_bate() { - QVector watch_x = {76.22, 92.209, 108.102, 123.901, 139.606, 155.221, 170.746, 186.182, 201.532, 216.797, 231.979, 247.077, 262.095, 277.033, 291.893, 306.675, 321.381, 336.012, 350.569, 365.054, 379.467, 393.809}; - - QVector watch_y = {25.0084, 31.0752, 37.0466, 42.9244, 48.7102, 54.4057, 60.0123, 65.5316, 70.965, 76.3141, 81.5801, 86.7644, 91.8684, 96.8932, 101.84, 106.711, 111.506, 116.226, 120.874, 125.45, 129.954, 134.389}; - - QVector fitting_para; - CBgWork::GetFileFittingPara(watch_x, watch_y, fitting_para); - + //算法部分 + bool bRet = false; + BgFileI inputFile; + CBgWork bgwork; + bool bFileAnlyseError = false; + QString sampleFile = "E:/AW/doc/USX79_005-20250708_2240_S_PREL_21592.5.PHD"; + printf(sampleFile.toStdString().c_str()); + // **************** printf("\n"); + QString gasFile = "E:/AW/doc/USX79_005-20250708_1040_G_FULL_40187.1.PHD"; + printf(gasFile.toStdString().c_str()); + // **************** printf("\n"); + QString detbgrFile = "E:/AW/doc/USX79_005-20220506_0101_D_FULL_259589.PHD"; + printf(detbgrFile.toStdString().c_str()); + // **************** printf("\n"); + BgAllGenerate allData; + if (!inputFile.Detbgr.AnalysePHD_File(detbgrFile)) + { + printf("In BgAnalyse,detbgrFile get failed:"); + printf(detbgrFile.toStdString().c_str()); + printf("\n"); + } + else if (!inputFile.gas.AnalysePHD_File(gasFile)) + { + printf("In BgAnalyse,gasFile get failed:"); + printf(gasFile.toStdString().c_str()); + printf("\n"); + } + else if (!inputFile.sample.AnalysePHD_File(sampleFile)) + { + printf("In BgAnalyse,sampleFile get failed:"); + printf(sampleFile.toStdString().c_str()); + printf("\n"); + } + else + { + bgwork.SetBgFile(inputFile); + bRet = bgwork.AutoAnalyse(); + allData = bgwork.GetAllValue(); + } + QString error_str = CBgWork::BgAnlyseError(bgwork.GetLastError()); printf(" ## test_bate"); + + printf("load file error : %s! \n",error_str.toStdString().c_str()); // bool bRet = false; // BgFileI inputFile; // CBgWork bgwork; @@ -5200,6 +5235,8 @@ jstring Java_org_jeecg_modules_native_1jni_EnergySpectrumHandler_selfBgAnalyse(J QJsonObject factorObj = inObj[name].toObject(); + bool bExist = factorObj["exist"].toBool(); + double halfLife = factorObj["halflife"].toString().toDouble() * (24 * 60 * 60); double sendOdds = factorObj["yield"].toString().toDouble() / 100.0; double area = factorObj["area"].toString().toDouble(); @@ -5235,7 +5272,7 @@ jstring Java_org_jeecg_modules_native_1jni_EnergySpectrumHandler_selfBgAnalyse(J double lambda = ln2 / T; double kc = lambda * tr / (1 - pow(e, -(lambda * tr))); double a_up = (area / f); - double a_low = (tl * bgeff * geff * sendOdds); + double a_low = (tr * bgeff * geff * sendOdds); double a = (a_up / a_low) * kc; double ac_mi = lambda * tp; double ac_e = pow(e, ac_mi); @@ -5244,6 +5281,10 @@ jstring Java_org_jeecg_modules_native_1jni_EnergySpectrumHandler_selfBgAnalyse(J double cBaseLine = factorObj["baseline"].toString().toDouble(); double ld = 2.71 + 4.65 * sqrt(cBaseLine); + if(!bExist) + { + ld = 2.71 + 4.65 * sqrt(area); + } double mda = (ld / a_low) * kc; double mdc = (1000 * mda / (vxe / 0.087)) * ac_e * ac_kc; @@ -5251,6 +5292,52 @@ jstring Java_org_jeecg_modules_native_1jni_EnergySpectrumHandler_selfBgAnalyse(J double conc_la = (lc / a_low) * kc; double conc_lc = (1000 * mda / (vxe / 0.087)) * ac_e * ac_kc; +// if(!bExist) +// { +// mdc = 2.71 + 4.65 * sqrt(area); +// printf("exist=false, tmpld : %lf \n",tmpld); +// mdc = (tmpld / a_low) * ac_kc * (0.087/vxe); + +// mdc = (1000*tmpld / a_low) * ac_kc * (0.087/vxe)*ac_e; +// } + + +// double c = tt * ac_kc * (0.087/vxe); + + printf("---------i----------: %d name:%s\n",i,name.toStdString().c_str()); + + printf("halfLife : %lf \n",halfLife); + printf("sendOdds : %lf \n",sendOdds); + printf("area : %lf \n",area); + printf("lcConst : %lf \n",lcConst); + printf("bgeff : %lf \n",bgeff); + printf("geff : %lf \n",geff); + printf("fxe : %lf \n",fxe); + printf("fn2 : %lf \n",fn2); + printf("f : %lf \n",f); + + + printf("e : %lf \n",e); + printf("ln2 : %lf \n",ln2); + printf("T : %lf \n",T); + printf("lambda : %lf \n",lambda); + printf("kc : %lf \n",kc); + printf("a_up : %lf \n",a_up); + printf("a_low : %lf \n",a_low); + printf("a : %lf \n",a); + printf("ac_mi : %lf \n",ac_mi); + printf("ac_e : %lf \n",ac_e); + printf("ac_kc : %lf \n",ac_kc); + printf("ac : %lf \n",ac); + printf("cBaseLine : %lf \n",cBaseLine); + printf("ld : %lf \n",ld); + printf("mda : %lf \n",mda); + printf("mdc : %lf \n",mdc); + printf("lc : %lf \n",lc); + printf("conc_la : %lf \n",conc_la); + printf("conc_lc : %lf \n",conc_lc); + printf("end---------i---------- : %d \n",i); + QJsonObject obj; obj["nuclideName"] = name; obj["conc"] = ac;