2025-05-29T17:19:11
This commit is contained in:
parent
cfcf8b0ecf
commit
2a23ee4c74
Binary file not shown.
Binary file not shown.
BIN
experiment_data/sample_data/20升温.xlsx
Normal file
BIN
experiment_data/sample_data/20升温.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/27-.xlsx
Normal file
BIN
experiment_data/sample_data/27-.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/27-new.xlsx
Normal file
BIN
experiment_data/sample_data/27-new.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/28-11.xlsx
Normal file
BIN
experiment_data/sample_data/28-11.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/28-1111.xlsx
Normal file
BIN
experiment_data/sample_data/28-1111.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/28-2.xlsx
Normal file
BIN
experiment_data/sample_data/28-2.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/28-22.xlsx
Normal file
BIN
experiment_data/sample_data/28-22.xlsx
Normal file
Binary file not shown.
@ -9,9 +9,9 @@ CONFIG+=precompile_header
|
|||||||
PRECOMPILED_HEADER=stable.h
|
PRECOMPILED_HEADER=stable.h
|
||||||
|
|
||||||
#
|
#
|
||||||
VERSION = 1.0.0
|
VERSION = 1.0.1
|
||||||
# 设置目标文件名,包含版本号
|
# 设置目标文件名,包含版本号
|
||||||
TARGET = AnalysisTool_$${VERSION}
|
TARGET = DSCAnalysisTool_$${VERSION}
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
# any Qt feature that has been marked deprecated (the exact warnings
|
# any Qt feature that has been marked deprecated (the exact warnings
|
||||||
|
File diff suppressed because one or more lines are too long
@ -31,6 +31,9 @@ const QString RateStr("rate");
|
|||||||
//
|
//
|
||||||
const double DefaultParamter = 8.177;
|
const double DefaultParamter = 8.177;
|
||||||
const double OnsetAndEndSetRate = 0.01;
|
const double OnsetAndEndSetRate = 0.01;
|
||||||
|
|
||||||
|
//curve object name
|
||||||
|
const QString objectNameExperiemnt("experiment");
|
||||||
//
|
//
|
||||||
enum LanguageType{
|
enum LanguageType{
|
||||||
Chinese,
|
Chinese,
|
||||||
|
@ -10,5 +10,6 @@
|
|||||||
<file>images/axis.png</file>
|
<file>images/axis.png</file>
|
||||||
<file>images/clear_data.png</file>
|
<file>images/clear_data.png</file>
|
||||||
<file>images/real_time.png</file>
|
<file>images/real_time.png</file>
|
||||||
|
<file>images/disconnect.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
BIN
src/images/disconnect.png
Normal file
BIN
src/images/disconnect.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
@ -15,8 +15,7 @@
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
system("chcp 65001");
|
||||||
system("chcp 65001");
|
|
||||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||||
QTextCodec::setCodecForLocale(codec);
|
QTextCodec::setCodecForLocale(codec);
|
||||||
|
|
||||||
@ -41,6 +40,7 @@ int main(int argc, char *argv[])
|
|||||||
logde<<"config,instrument coefficient:"
|
logde<<"config,instrument coefficient:"
|
||||||
<<ConfigHandler::_configMap[ConInstrumentCoefficientStr].toFloat();
|
<<ConfigHandler::_configMap[ConInstrumentCoefficientStr].toFloat();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 启用高DPI缩放
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 启用高DPI缩放
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
@ -58,7 +58,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
w.setWindowTitle("Analysis Tool");
|
w.setWindowTitle("DSC Analysis Tool");
|
||||||
// w.setWindowIcon(QIcon(":/images/logo.png"));
|
// w.setWindowIcon(QIcon(":/images/logo.png"));
|
||||||
w.setWindowIcon(icon);
|
w.setWindowIcon(icon);
|
||||||
w.show();
|
w.show();
|
||||||
|
@ -354,28 +354,41 @@ void MainWindow::slotSaveExperimentalDataMsgBox()
|
|||||||
} else {
|
} else {
|
||||||
on_actionClearAllData_triggered();
|
on_actionClearAllData_triggered();
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
// Clear data.
|
// Clear data.
|
||||||
logde<<"save mesg box.clearExperimentData...";
|
logde<<"save mesg box.clearExperimentData...";
|
||||||
Global::clearExperimentData();
|
Global::clearExperimentData();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionConnectToDev_triggered()
|
void MainWindow::on_actionConnectToDev_triggered()
|
||||||
{
|
{
|
||||||
logde<<"Connect to device.";
|
if(SerialPort::instance()->isOpen()){
|
||||||
|
SerialPort::instance()->closeSp();
|
||||||
|
|
||||||
if (SerialPort::instance()->openSp())
|
ui->actionConnectToDev->setIcon(QIcon(":/images/connect.png"));
|
||||||
{
|
ui->actionConnectToDev->setText("连接设备");
|
||||||
setActionEnable(true);
|
|
||||||
// Global::instance()->setMode(Global::Mode::ConnectedToDev);
|
|
||||||
Global::_mode = Global::Mode::ConnectedToDev;
|
|
||||||
|
|
||||||
QByteArray ba = DataParser::inquirePhaseInfo();
|
logde<<"close serial port.";
|
||||||
SerialPort::instance()->sendData(ba);
|
}else{
|
||||||
}
|
if (SerialPort::instance()->openSp())
|
||||||
else
|
{
|
||||||
{
|
setActionEnable(true);
|
||||||
QMessageBox::warning(this, "warnning", "Serial Port open failed.");
|
// Global::instance()->setMode(Global::Mode::ConnectedToDev);
|
||||||
|
Global::_mode = Global::Mode::ConnectedToDev;
|
||||||
|
|
||||||
|
QByteArray ba = DataParser::inquirePhaseInfo();
|
||||||
|
SerialPort::instance()->sendData(ba);
|
||||||
|
|
||||||
|
ui->actionConnectToDev->setIcon(QIcon(":/images/disconnect.png"));
|
||||||
|
ui->actionConnectToDev->setText("断开连接");
|
||||||
|
|
||||||
|
logde<<"open serial port.";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, "warnning", "Serial Port open failed.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,4 +126,5 @@ private:
|
|||||||
PrintPreviewForm *_printPreviewForm;
|
PrintPreviewForm *_printPreviewForm;
|
||||||
AxisSettingForm * _axisSettingForm;
|
AxisSettingForm * _axisSettingForm;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
@ -19,7 +19,8 @@ const u16 conVid = 1155; // 0x0483
|
|||||||
const u16 conPid = 22336; // 0x5740
|
const u16 conPid = 22336; // 0x5740
|
||||||
|
|
||||||
SerialPort::SerialPort(QObject *parent)
|
SerialPort::SerialPort(QObject *parent)
|
||||||
: QObject(parent), _sp(nullptr)
|
: QObject(parent)
|
||||||
|
,_sp(new QSerialPort(this))
|
||||||
{
|
{
|
||||||
// displayPortInfo();
|
// displayPortInfo();
|
||||||
|
|
||||||
@ -333,7 +334,7 @@ bool SerialPort::openSp()
|
|||||||
|
|
||||||
if ((pid == conPid) && (vid == conVid))
|
if ((pid == conPid) && (vid == conVid))
|
||||||
{
|
{
|
||||||
_sp = new QSerialPort(info);
|
_sp->setPort(info);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,6 +372,15 @@ bool SerialPort::openSp()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SerialPort::closeSp()
|
||||||
|
{
|
||||||
|
if (_sp && _sp->isOpen())
|
||||||
|
{
|
||||||
|
_sp->clear();
|
||||||
|
_sp->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SerialPort::sendCmd(const SerialPort::E_CMD_TYPE e)
|
void SerialPort::sendCmd(const SerialPort::E_CMD_TYPE e)
|
||||||
{
|
{
|
||||||
#if 1
|
#if 1
|
||||||
|
@ -27,7 +27,8 @@ public:
|
|||||||
void sendCmd(const E_CMD_TYPE e);
|
void sendCmd(const E_CMD_TYPE e);
|
||||||
static void parserTest();
|
static void parserTest();
|
||||||
bool openSp();
|
bool openSp();
|
||||||
|
bool isOpen(){return _sp->isOpen();}
|
||||||
|
bool closeSp();
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *event);
|
void timerEvent(QTimerEvent *event);
|
||||||
signals:
|
signals:
|
||||||
|
@ -178,17 +178,15 @@ void CentralWidget::slotRecvCommonData(const CommonData &cd)
|
|||||||
if(!_currentCurve){
|
if(!_currentCurve){
|
||||||
logde<<"_currentCurve is nullptr";
|
logde<<"_currentCurve is nullptr";
|
||||||
_currentCurve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis);
|
_currentCurve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis);
|
||||||
|
_currentCurve->setObjectName(Global::objectNameExperiemnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// logde<<"temp:"<<cd.sample_temp<<",dsc:"<<cd.dsc;
|
// logde<<"temp:"<<cd.sample_temp<<",dsc:"<<cd.dsc;
|
||||||
|
|
||||||
_currentCurve->addData(index++,cd.sample_temp, cd.dsc);
|
_currentCurve->addData(index++,cd.sample_temp, cd.dsc);
|
||||||
|
|
||||||
// _customPlot->rescaleAxes();
|
// _customPlot->rescaleAxes();
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
|
|
||||||
// return;
|
|
||||||
|
|
||||||
// Record data.
|
// Record data.
|
||||||
if(!Global::_currentCurveExperimentDataPtr){
|
if(!Global::_currentCurveExperimentDataPtr){
|
||||||
loger<<"_currentCurveExperimentDataPtr is nullptr.";
|
loger<<"_currentCurveExperimentDataPtr is nullptr.";
|
||||||
@ -245,8 +243,10 @@ void CentralWidget::slotAnalysisSettingApply()
|
|||||||
|
|
||||||
if(Global::_curveFileDataVtr.empty()){
|
if(Global::_curveFileDataVtr.empty()){
|
||||||
// Load experiment data.
|
// Load experiment data.
|
||||||
|
logde<<"experiment vtr size:"<<Global::_curveExperimentDataVtr.size();
|
||||||
for(Global::CurveExperimentData& ced:Global::_curveExperimentDataVtr){
|
for(Global::CurveExperimentData& ced:Global::_curveExperimentDataVtr){
|
||||||
if(ced.curve == _currentCurve){
|
if(ced.curve == _currentCurve){
|
||||||
|
logde<<"load experiment data.";
|
||||||
PointCalculate::setAnalysisData(ced.dataVtr);
|
PointCalculate::setAnalysisData(ced.dataVtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -428,17 +428,18 @@ void CentralWidget::slotSelectionChangedByUser()
|
|||||||
for (QCPAbstractPlottable* plottable : selectedPlottables) {
|
for (QCPAbstractPlottable* plottable : selectedPlottables) {
|
||||||
// 检查是否是 QCPCurve
|
// 检查是否是 QCPCurve
|
||||||
if (QCPCurve* curve = dynamic_cast<QCPCurve*>(plottable)) {
|
if (QCPCurve* curve = dynamic_cast<QCPCurve*>(plottable)) {
|
||||||
qDebug() << "Selected Curve:" << curve->objectName();
|
logde << "Selected Curve:" << curve->objectName().toStdString();
|
||||||
logde<<curve->objectName().toStdString();
|
|
||||||
_currentCurve = curve; // 更新当前选中的曲线
|
_currentCurve = curve; // 更新当前选中的曲线
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
// 如果没有选中的曲线
|
// 如果没有选中的曲线
|
||||||
if (selectedPlottables.isEmpty()) {
|
if (selectedPlottables.isEmpty()) {
|
||||||
qDebug() << "No curve selected";
|
logde<< "No curve selected";
|
||||||
_currentCurve = nullptr; // 清空当前选中的曲线
|
_currentCurve = nullptr; // 清空当前选中的曲线
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::uiLoadXlsxFileData()
|
void CentralWidget::uiLoadXlsxFileData()
|
||||||
@ -719,8 +720,6 @@ void CentralWidget::glassTransitionHandle(const double x1,const double x2,const
|
|||||||
}
|
}
|
||||||
|
|
||||||
drawText(averagePoint,str);
|
drawText(averagePoint,str);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// 使用最小二乘法计算线性回归
|
// 使用最小二乘法计算线性回归
|
||||||
PointCalculate::Line CentralWidget::calculateLinearRegression(const QVector<double>& x, const QVector<double>& y) {
|
PointCalculate::Line CentralWidget::calculateLinearRegression(const QVector<double>& x, const QVector<double>& y) {
|
||||||
@ -1250,6 +1249,7 @@ void CentralWidget::loadAnalysisData(
|
|||||||
peakPointTime,
|
peakPointTime,
|
||||||
startPointTime,
|
startPointTime,
|
||||||
endPointTime);
|
endPointTime);
|
||||||
|
|
||||||
drawText(peakPoint,str,objectName);
|
drawText(peakPoint,str,objectName);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
@ -391,6 +391,7 @@ void ExperimentSettingForm::on_pushButton_deliverData_clicked()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Phase phase;
|
Phase phase;
|
||||||
phase.onoff = ui->checkBox_phase_2->checkState()?1:0;
|
phase.onoff = ui->checkBox_phase_2->checkState()?1:0;
|
||||||
@ -402,15 +403,18 @@ void ExperimentSettingForm::on_pushButton_deliverData_clicked()
|
|||||||
|
|
||||||
phaseVtr.push_back(phase);
|
phaseVtr.push_back(phase);
|
||||||
//
|
//
|
||||||
phase2CutoffTemp = phase.cutoff_temp;
|
if(phase.onoff){
|
||||||
if(phase2CutoffTemp < phase1CutoffTemp){
|
logde<<"phase 2 enable.";
|
||||||
phaseCufoffTempErrorMesgBox(2);
|
phase2CutoffTemp = phase.cutoff_temp;
|
||||||
return;
|
if(phase2CutoffTemp < phase1CutoffTemp){
|
||||||
}
|
phaseCufoffTempErrorMesgBox(2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(phase.temp_flow <= 0){
|
if(phase.temp_flow <= 0){
|
||||||
phaseScanRateErrorMesgBox(2);
|
phaseScanRateErrorMesgBox(2);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,15 +428,18 @@ void ExperimentSettingForm::on_pushButton_deliverData_clicked()
|
|||||||
|
|
||||||
phaseVtr.push_back(phase);
|
phaseVtr.push_back(phase);
|
||||||
//
|
//
|
||||||
phase3CutoffTemp = phase.cutoff_temp;
|
if(phase.onoff){
|
||||||
if(phase3CutoffTemp < phase2CutoffTemp){
|
logde<<"phase 3 enable.";
|
||||||
phaseCufoffTempErrorMesgBox(3);
|
phase3CutoffTemp = phase.cutoff_temp;
|
||||||
return;
|
if(phase3CutoffTemp < phase2CutoffTemp){
|
||||||
}
|
phaseCufoffTempErrorMesgBox(3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(phase.temp_flow <= 0){
|
if(phase.temp_flow <= 0){
|
||||||
phaseScanRateErrorMesgBox(3);
|
phaseScanRateErrorMesgBox(3);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,15 +453,18 @@ void ExperimentSettingForm::on_pushButton_deliverData_clicked()
|
|||||||
phase.gas = GasType::N2;
|
phase.gas = GasType::N2;
|
||||||
phaseVtr.push_back(phase);
|
phaseVtr.push_back(phase);
|
||||||
//
|
//
|
||||||
phase4CutoffTemp = phase.cutoff_temp;
|
if(phase.onoff){
|
||||||
if(phase4CutoffTemp < phase3CutoffTemp){
|
logde<<"phase 4 enable.";
|
||||||
phaseCufoffTempErrorMesgBox(4);
|
phase4CutoffTemp = phase.cutoff_temp;
|
||||||
return;
|
if(phase4CutoffTemp < phase3CutoffTemp){
|
||||||
}
|
phaseCufoffTempErrorMesgBox(4);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(phase.temp_flow <= 0){
|
if(phase.temp_flow <= 0){
|
||||||
phaseScanRateErrorMesgBox(4);
|
phaseScanRateErrorMesgBox(4);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,15 +479,18 @@ void ExperimentSettingForm::on_pushButton_deliverData_clicked()
|
|||||||
|
|
||||||
phaseVtr.push_back(phase);
|
phaseVtr.push_back(phase);
|
||||||
//
|
//
|
||||||
phase5CutoffTemp = phase.cutoff_temp;
|
if(phase.onoff){
|
||||||
if(phase5CutoffTemp < phase4CutoffTemp){
|
logde<<"phase 5 enable.";
|
||||||
phaseCufoffTempErrorMesgBox(5);
|
phase5CutoffTemp = phase.cutoff_temp;
|
||||||
return;
|
if(phase5CutoffTemp < phase4CutoffTemp){
|
||||||
}
|
phaseCufoffTempErrorMesgBox(5);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(phase.temp_flow <= 0){
|
if(phase.temp_flow <= 0){
|
||||||
phaseScanRateErrorMesgBox(5);
|
phaseScanRateErrorMesgBox(5);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,15 +505,18 @@ void ExperimentSettingForm::on_pushButton_deliverData_clicked()
|
|||||||
|
|
||||||
phaseVtr.push_back(phase);
|
phaseVtr.push_back(phase);
|
||||||
//
|
//
|
||||||
phase6CutoffTemp = phase.cutoff_temp;
|
if(phase.onoff){
|
||||||
if(phase6CutoffTemp < phase5CutoffTemp){
|
logde<<"phase 6 enable.";
|
||||||
phaseCufoffTempErrorMesgBox(6);
|
phase6CutoffTemp = phase.cutoff_temp;
|
||||||
return;
|
if(phase6CutoffTemp < phase5CutoffTemp){
|
||||||
}
|
phaseCufoffTempErrorMesgBox(6);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(phase.temp_flow <= 0){
|
if(phase.temp_flow <= 0){
|
||||||
phaseScanRateErrorMesgBox(6);
|
phaseScanRateErrorMesgBox(6);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user