2025-06-23T10:42:13
This commit is contained in:
parent
0a359b4645
commit
2b879ef928
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
AnalysisTool-release/bin/DSCAnalysisTool_1.0.5.exe
Normal file
BIN
AnalysisTool-release/bin/DSCAnalysisTool_1.0.5.exe
Normal file
Binary file not shown.
4
AnalysisTool-release/bin/log/20250623.log
Normal file
4
AnalysisTool-release/bin/log/20250623.log
Normal file
@ -0,0 +1,4 @@
|
||||
[2025-06-23 08:57:37,833] main...
|
||||
[2025-06-23 08:57:37,835] config file existed.
|
||||
[2025-06-23 08:57:37,872] version:1.0.5.0
|
||||
[2025-06-23 08:57:37,898] setEventHandlerEnable...0
|
Binary file not shown.
BIN
experiment_data/sample_data/1111.xlsx
Normal file
BIN
experiment_data/sample_data/1111.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/1111_2025_06_23_10_19_29.xlsx
Normal file
BIN
experiment_data/sample_data/1111_2025_06_23_10_19_29.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/1111_2025_06_23_10_23_23.xlsx
Normal file
BIN
experiment_data/sample_data/1111_2025_06_23_10_23_23.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/22222222.xlsx
Normal file
BIN
experiment_data/sample_data/22222222.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/3333.xlsx
Normal file
BIN
experiment_data/sample_data/3333.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/3333_2025_06_23_10_31_51.xlsx
Normal file
BIN
experiment_data/sample_data/3333_2025_06_23_10_31_51.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/34new.xlsx
Normal file
BIN
experiment_data/sample_data/34new.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/4444.xlsx
Normal file
BIN
experiment_data/sample_data/4444.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/4444_2025_06_23_10_32_45.xlsx
Normal file
BIN
experiment_data/sample_data/4444_2025_06_23_10_32_45.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/49-test.xlsx
Normal file
BIN
experiment_data/sample_data/49-test.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/55-test.xlsx
Normal file
BIN
experiment_data/sample_data/55-test.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/55-test_2025_06_23_10_02_15.xlsx
Normal file
BIN
experiment_data/sample_data/55-test_2025_06_23_10_02_15.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/555.xlsx
Normal file
BIN
experiment_data/sample_data/555.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/555_2025_06_23_10_38_40.xlsx
Normal file
BIN
experiment_data/sample_data/555_2025_06_23_10_38_40.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/6666.xlsx
Normal file
BIN
experiment_data/sample_data/6666.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/dodu.xlsx
Normal file
BIN
experiment_data/sample_data/dodu.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/dodu_2025_06_23_10_13_30.xlsx
Normal file
BIN
experiment_data/sample_data/dodu_2025_06_23_10_13_30.xlsx
Normal file
Binary file not shown.
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_06_23_09_52_31.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_06_23_09_52_31.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_06_23_10_00_30.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_06_23_10_00_30.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_06_23_10_01_22.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_06_23_10_01_22.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_06_23_10_03_35.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_06_23_10_03_35.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_06_23_10_05_57.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_06_23_10_05_57.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_06_23_10_08_17.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_06_23_10_08_17.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_06_23_10_11_40.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_06_23_10_11_40.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_06_23_10_13_05.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_06_23_10_13_05.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_06_23_10_17_29.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_06_23_10_17_29.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_06_23_10_17_30.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_06_23_10_17_30.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_06_23_10_18_56.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_06_23_10_18_56.xlsx
Normal file
Binary file not shown.
Binary file not shown.
@ -9,7 +9,7 @@ CONFIG+=precompile_header
|
||||
PRECOMPILED_HEADER=stable.h
|
||||
|
||||
#
|
||||
VERSION = 1.0.5
|
||||
VERSION = 1.0.6
|
||||
# 设置目标文件名,包含版本号
|
||||
TARGET = DSCAnalysisTool_$${VERSION}
|
||||
|
||||
|
@ -60,7 +60,8 @@ void OITAutoAnalysis::analysis()
|
||||
if((ed.runTime > Global::_OITAutoAnalysisCoefficient)
|
||||
&& (ed.dsc - phase2FirstData.dsc > Global::_OITAutoAnalysisThreshold)){
|
||||
//
|
||||
double x1 = phase2FirstData.runTime;
|
||||
// double x1 = phase2FirstData.runTime;
|
||||
double x1 = ConDefaultXValue;
|
||||
double x2 = ed.runTime;
|
||||
emit sigExperimentStop(x1,x2);
|
||||
|
||||
|
@ -7,6 +7,8 @@ class OITAutoAnalysis : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
const double ConDefaultXValue = -1.0;
|
||||
|
||||
explicit OITAutoAnalysis(QObject *parent = nullptr);
|
||||
|
||||
static OITAutoAnalysis* getInstance()
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "logger.h"
|
||||
#include "global.h"
|
||||
#include "confighandler.h"
|
||||
#include "oitautoanalysis.h"
|
||||
|
||||
QVector<Global::ExperimentData>PointCalculate:: _dataVtr;
|
||||
QPointF PointCalculate::_peakPoint;
|
||||
@ -933,6 +934,7 @@ Global::ExperimentData PointCalculate::findOnSetDataByTime(const double x1, cons
|
||||
|
||||
Global::ExperimentData PointCalculate::getOITStartData(const double x1,const double x2)
|
||||
{
|
||||
|
||||
Global::ExperimentData startEd = _dataVtr.first();
|
||||
|
||||
logde<<"startEd phase index:"<<startEd.phaseIndex;
|
||||
@ -1008,14 +1010,15 @@ PointCalculate::calculateOITStartAndEndDataByTime(const double x1, const double
|
||||
{
|
||||
// 获取起点数据。
|
||||
Global::ExperimentData startData = getOITStartData(x1,x2);
|
||||
|
||||
// 计算OIT结束数据(需根据实际逻辑实现)
|
||||
Global::ExperimentData endData;
|
||||
//
|
||||
ExperimentData selectedData = getClosestDataByTime(x1);
|
||||
if(Global::isEqual(OITAutoAnalysis::getInstance()->ConDefaultXValue,x1)){
|
||||
selectedData = calculateMedianOIT().second;
|
||||
}
|
||||
|
||||
QPair<Global::ExperimentData,Global::ExperimentData> maxDiffDataPair =
|
||||
calculateMaxDiffDataByTime(x1,x2);
|
||||
|
||||
ExperimentData selectedData = getClosestDataByTime(x1);
|
||||
Global::ExperimentData endData;
|
||||
|
||||
// calculate intersection point.
|
||||
QPointF selectedPoint1(selectedData.runTime,selectedData.dsc);
|
||||
@ -1100,3 +1103,30 @@ PointCalculate::calculateMaxDiffDataByTime(
|
||||
return qMakePair(currentPoint,lastPoint);
|
||||
#endif
|
||||
}
|
||||
|
||||
// 返回值: first=true表示计算成功,second是中位数
|
||||
std::pair<bool, Global::ExperimentData> PointCalculate::calculateMedianOIT(){
|
||||
ExperimentData ed;
|
||||
if (_dataVtr.empty()) return std::make_pair(false, ed);
|
||||
|
||||
// 创建数据副本用于排序
|
||||
std::vector<ExperimentData> sortedData(_dataVtr.begin(),_dataVtr.end());
|
||||
|
||||
// 定义排序比较函数,使用value成员进行比较
|
||||
auto compare = [](const ExperimentData& a, const ExperimentData& b) {
|
||||
return a.dsc < b.dsc;
|
||||
};
|
||||
|
||||
// 对数据进行排序
|
||||
std::sort(sortedData.begin(), sortedData.end(), compare);
|
||||
|
||||
// 计算中位数
|
||||
size_t n = sortedData.size();
|
||||
if (n % 2 == 0) {
|
||||
// 数据个数为偶数,中位数是中间两个数的平均值
|
||||
return std::make_pair(true, sortedData[n/2 - 1]);
|
||||
} else {
|
||||
// 数据个数为奇数,中位数是中间的数
|
||||
return std::make_pair(true, sortedData[n/2]);
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ ExperimentData findOnSetDataByTime(const double x1,const double x2);
|
||||
ExperimentData findEndSetDataByTime(const double x1,const double x2);
|
||||
|
||||
ExperimentData getOITStartData(const double x1,const double x2);
|
||||
|
||||
std::pair<bool, ExperimentData> calculateMedianOIT();
|
||||
// text format
|
||||
QString textFormatPeakPoint(const float enthalpyValue,
|
||||
const float peakValue,
|
||||
|
@ -149,6 +149,11 @@ bool isZero(double value, double epsilon) {
|
||||
return std::abs(value) < epsilon;
|
||||
}
|
||||
|
||||
bool isEqual(const double a, const double b) {
|
||||
const double tolerance = 1e-5; // 容差值,可以根据需要调整
|
||||
return std::fabs(a - b) < tolerance;
|
||||
}
|
||||
|
||||
QString getFileName(const QString filePath)
|
||||
{
|
||||
QFileInfo fileInfo(filePath);
|
||||
|
@ -180,7 +180,9 @@ QString converDoubleToStr(const double);
|
||||
void quadraticLeastSquaresFit(double x[], double y[], int n, double coeff[]);
|
||||
double findNegativeStartPoint(double m, double b, double start, double end);
|
||||
bool isZero(double value, double epsilon = 1e-9);
|
||||
bool isEqual(const double a,const double b);
|
||||
QString getFileName(const QString filePath);
|
||||
|
||||
};
|
||||
|
||||
#endif // GLOBAL_H
|
||||
|
@ -258,6 +258,8 @@ bool MainWindow::saveAnalysisFile(const QString fileName)
|
||||
bool MainWindow::saveFile(const QString fileName,const Global::Mode mode,
|
||||
QString& finalFileName,const bool autoSaveFlag)
|
||||
{
|
||||
logde<<"save file...";
|
||||
|
||||
QString localFileName = fileName;
|
||||
if(fileName.isEmpty()){
|
||||
localFileName = "new";
|
||||
@ -460,11 +462,15 @@ void MainWindow::on_actionStop_triggered()
|
||||
QByteArray ba = DataParser::setDeviceStartStop(DeviceStartMode::Stop);
|
||||
SerialPort::instance()->slotSendData(ba);
|
||||
|
||||
#if 1
|
||||
// Set software mode to analysis.
|
||||
_manuallyStopTheExperimentFlag = true;
|
||||
logde<<"_manuallyStopTheExperimentFlag:"<<_manuallyStopTheExperimentFlag;
|
||||
|
||||
Global::_mode = Global::Mode::Analysis;
|
||||
|
||||
// Save data.
|
||||
// if(saveExperimentFile(Global::_experimentInfo.sampleName)){
|
||||
// _leftWidget->reloadFileName();
|
||||
// }
|
||||
#if 1
|
||||
logde<<"on_actionStop_triggered saveFile ...";
|
||||
|
||||
QString finalFileName;
|
||||
if(saveFile(Global::_experimentInfo.sampleName,Global::Mode::Experiment,finalFileName,true)){
|
||||
@ -475,10 +481,6 @@ void MainWindow::on_actionStop_triggered()
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set software mode to analysis.
|
||||
Global::_mode = Global::Mode::Analysis;
|
||||
|
||||
_manuallyStopTheExperimentFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -520,12 +522,15 @@ void MainWindow::on_actionRealTimeWidget_triggered()
|
||||
|
||||
void MainWindow::slotSaveExperimentalDataMsgBox()
|
||||
{
|
||||
logde<<"_manuallyStopTheExperimentFlag:"<<_manuallyStopTheExperimentFlag;
|
||||
|
||||
if(_manuallyStopTheExperimentFlag){
|
||||
logde<<"_manuallyStopTheExperimentFlag...";
|
||||
return;
|
||||
}
|
||||
|
||||
// auto save file.
|
||||
logde<<"slotSaveExperimentalDataMsgBox saveFile ...";
|
||||
QString finalFileName;
|
||||
if(saveFile(Global::_experimentInfo.sampleName,Global::Mode::Experiment,finalFileName,true)){
|
||||
_leftWidget->reloadFileName();
|
||||
|
@ -209,20 +209,23 @@ void SerialPort::updateStatus(const CommonData &cd)
|
||||
|
||||
emit sigUpdateStatusbarMsg(msg);
|
||||
|
||||
#if 1
|
||||
// If save experiment data.
|
||||
static Global::Mode preMode = Global::Mode::Analysis;
|
||||
bool sendSignalFlag = false;
|
||||
bool sendSaveSignalFlag = false;
|
||||
if(Global::_mode != preMode){
|
||||
if(preMode == Global::Mode::Experiment
|
||||
&& Global::_mode == Global::Mode::Analysis){
|
||||
sendSignalFlag = true;
|
||||
sendSaveSignalFlag = true;
|
||||
}
|
||||
|
||||
preMode = Global::_mode;
|
||||
}
|
||||
if(sendSignalFlag && !Global::_OITAutoAnalysisModeFlag){
|
||||
|
||||
if(sendSaveSignalFlag && !Global::_OITAutoAnalysisModeFlag){
|
||||
emit sigSaveExperimentalDataMsgBox();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SerialPort::commonDataParser(const int dataLength, const u16 addr,
|
||||
|
Loading…
Reference in New Issue
Block a user