2025-06-26T08:58:59

This commit is contained in:
yuntang 2025-06-26 08:58:59 +08:00
parent 25d9fe5166
commit 3551a87337
10 changed files with 40 additions and 21 deletions

View File

@ -9,7 +9,7 @@ CONFIG+=precompile_header
PRECOMPILED_HEADER=stable.h PRECOMPILED_HEADER=stable.h
# #
VERSION = 1.0.6 VERSION = 1.0.8
# 设置目标文件名,包含版本号 # 设置目标文件名,包含版本号
TARGET = DSCAnalysisTool_$${VERSION} TARGET = DSCAnalysisTool_$${VERSION}

View File

@ -37,6 +37,7 @@ void ConfigHandler::reader()
_configMap[ConInstrumentCoefficientStr] = QVariant(obj[ConInstrumentCoefficientStr].toDouble()); _configMap[ConInstrumentCoefficientStr] = QVariant(obj[ConInstrumentCoefficientStr].toDouble());
} }
#if 0 #if 0
void ConfigHandler::createDefaultFile() void ConfigHandler::createDefaultFile()
{ {

View File

@ -3,9 +3,9 @@
#include <QtCore> #include <QtCore>
const QString ConInstrumentCoefficientStr = "InstrumentCoefficient";
namespace ConfigHandler { namespace ConfigHandler {
const QString ConInstrumentCoefficientStr = "InstrumentCoefficient";
const float ConInstrumentCoefficientDefaultValue = 1.0;
const QString ConConfigFilePath = QDir::currentPath() + "/config.json"; const QString ConConfigFilePath = QDir::currentPath() + "/config.json";
const QMap<QString, QVariant> ConDefaultMap = { const QMap<QString, QVariant> ConDefaultMap = {
@ -17,6 +17,7 @@ extern QMap<QString, QVariant> _configMap;
// //
void reader(); void reader();
//void createDefaultFile(); //void createDefaultFile();
/** /**
* @brief writer * @brief writer
* @param writeRealDataFlag * @param writeRealDataFlag

View File

@ -253,8 +253,8 @@ float PointCalculate::calculateArea() {
/* /*
* H = K * S / w; * H = K * S / w;
*/ */
float coefficient = ConfigHandler::_configMap.value(ConInstrumentCoefficientStr).toFloat(); float coefficient = ConfigHandler::_configMap.value(ConfigHandler::ConInstrumentCoefficientStr).toFloat();
logde<<"coefficient:"<<coefficient; logde<<"coefficient 1:"<<coefficient;
if(Global::_enthalpyCoefficientEnableFlag){ if(Global::_enthalpyCoefficientEnableFlag){
logde<<"_enthalpyCoefficientEnableFlag..."; logde<<"_enthalpyCoefficientEnableFlag...";
@ -271,11 +271,15 @@ float PointCalculate::calculateArea() {
b * startTemp + b * startTemp +
c; c;
logde<<"coefficient:"<<coefficient; if(coefficient <= 0.0){
coefficient = 1.0;
}
logde<<"coefficient 2:"<<coefficient;
} }
logde<<"integral:"<<integral; logde<<"integral:"<<integral;
logde<<"coefficient:"<<coefficient; logde<<"coefficient 3:"<<coefficient;
logde<<"Global::DefaultParamter:"<<Global::DefaultParamter; logde<<"Global::DefaultParamter:"<<Global::DefaultParamter;
float area = integral * coefficient * Global::DefaultParamter; float area = integral * coefficient * Global::DefaultParamter;

View File

@ -26,6 +26,7 @@ const QString SampleData("sampleData");
const QString Atmosphere("atmosphere"); const QString Atmosphere("atmosphere");
const QString HeatingRate("heatingRate"); const QString HeatingRate("heatingRate");
const QString ElementName("elementName");
const QString SampleName("sampleName"); const QString SampleName("sampleName");
const QString TemperatureStr("temperature"); const QString TemperatureStr("temperature");
const QString RateStr("rate"); const QString RateStr("rate");

View File

@ -1412,7 +1412,7 @@ void CentralWidget::calculateAnalysisResult(
//enthalpy //enthalpy
double sampleWeight = 1.0f; double sampleWeight = 1.0f;
if(Global::_curveFileDataVtr.empty()){ if(Global::_curveFileDataVtr.empty()){
sampleWeight = Global::converStrToDouble(Global::_experimentInfo.sampleWeight); sampleWeight = Global::converStrToDouble(Global::_experimentInfo.sampleWeight);
}else{ }else{
for(Global::CurveFileData& cfd:Global::_curveFileDataVtr){ for(Global::CurveFileData& cfd:Global::_curveFileDataVtr){
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){ for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
@ -1477,7 +1477,7 @@ void CentralWidget::calculateAnalysisResult(
double startPointTime = PointCalculate::obtainTimeValueBasedOnTemperatureValue(startEndPointPair.first.x()); double startPointTime = PointCalculate::obtainTimeValueBasedOnTemperatureValue(startEndPointPair.first.x());
double endPointTime = PointCalculate::obtainTimeValueBasedOnTemperatureValue(startEndPointPair.second.x()); double endPointTime = PointCalculate::obtainTimeValueBasedOnTemperatureValue(startEndPointPair.second.x());
str = PointCalculate::textFormatPeakPointWithTime( str = PointCalculate::textFormatPeakPointWithTime(
enthalpyValue, enthalpyValue,
peakPointTime, peakPointTime,
startPointTime, startPointTime,
@ -1486,10 +1486,11 @@ void CentralWidget::calculateAnalysisResult(
drawText(peakPoint,str,objectName); drawText(peakPoint,str,objectName);
}else{ }else{
str = PointCalculate::textFormatPeakPoint(enthalpyValue, str = PointCalculate::textFormatPeakPoint(
peakPoint.x(), enthalpyValue,
startEndPointPair.first.x(), peakPoint.x(),
startEndPointPair.second.x()); startEndPointPair.first.x(),
startEndPointPair.second.x());
drawText(peakPoint,str,objectName); drawText(peakPoint,str,objectName);
} }

View File

@ -9,6 +9,7 @@
CoefficientSelectionForm::CoefficientSelectionForm(QWidget *parent) : CoefficientSelectionForm::CoefficientSelectionForm(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::CoefficientSelectionForm) ui(new Ui::CoefficientSelectionForm)
,_instrumentCoefficient(ConfigHandler::ConInstrumentCoefficientDefaultValue)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -17,7 +18,7 @@ CoefficientSelectionForm::CoefficientSelectionForm(QWidget *parent) :
#if 1 #if 1
ui->LineEditCoefficient->setText( ui->LineEditCoefficient->setText(
QString::number( QString::number(
ConfigHandler::_configMap[ConInstrumentCoefficientStr].toFloat(), ConfigHandler::_configMap[ConfigHandler::ConInstrumentCoefficientStr].toFloat(),
'f',3)); 'f',3));
#endif #endif
@ -42,18 +43,25 @@ void CoefficientSelectionForm::showEvent(QShowEvent *event)
void CoefficientSelectionForm::on_pushButtonCalculate_clicked() void CoefficientSelectionForm::on_pushButtonCalculate_clicked()
{ {
float theory = ui->LineEditTheory->text().toFloat(); bool ok;
float measure = ui->LineEditActualMeasurement->text().toFloat(); float theory = ui->LineEditTheory->text().toFloat(&ok);
if(!ok){
theory = 1.0;
}
float measure = ui->LineEditActualMeasurement->text().toFloat(&ok);
if(!ok){
measure = 1.0;
}
_instrumentCoefficient = theory/measure; _instrumentCoefficient = theory/measure;
ui->LineEditCoefficient->setText(QString::number(_instrumentCoefficient,'f',3)); ui->LineEditCoefficient->setText(QString::number(_instrumentCoefficient,'f',3));
} }
void CoefficientSelectionForm::on_pushButtonConfirm_clicked() void CoefficientSelectionForm::on_pushButtonConfirm_clicked()
{ {
if(ui->radioButtonSinglePointCoefficient->isChecked()){ if(ui->radioButtonSinglePointCoefficient->isChecked()){
ConfigHandler::_configMap[ConInstrumentCoefficientStr] = _instrumentCoefficient; ConfigHandler::_configMap[ConfigHandler::ConInstrumentCoefficientStr] = _instrumentCoefficient;
ConfigHandler::writer(); ConfigHandler::writer();
Global::_enthalpyCoefficientEnableFlag = false; Global::_enthalpyCoefficientEnableFlag = false;
@ -155,6 +163,8 @@ void CoefficientSelectionForm::on_pushButtonSelectFile_clicked()
ui->labelFilePath->setToolTip(filePath); ui->labelFilePath->setToolTip(filePath);
ui->textEditFileContent->setText(_jsonStr); ui->textEditFileContent->setText(_jsonStr);
_instrumentCoefficient = ConfigHandler::ConInstrumentCoefficientDefaultValue;
} }
void CoefficientSelectionForm::on_radioButtonSinglePointCoefficient_toggled(bool checked) void CoefficientSelectionForm::on_radioButtonSinglePointCoefficient_toggled(bool checked)

View File

@ -185,6 +185,7 @@ void EnthalpyDataCorrectionForm::saveJson()
QJsonArray jsonArray; QJsonArray jsonArray;
for (const TheoryData &data : _theoryDataVtr) { for (const TheoryData &data : _theoryDataVtr) {
QJsonObject jsonObj; QJsonObject jsonObj;
jsonObj[Global::ElementName] = data.elementName;
jsonObj[Global::TemperatureStr] = data.temperature; jsonObj[Global::TemperatureStr] = data.temperature;
jsonObj[Global::RateStr] = data.rate; jsonObj[Global::RateStr] = data.rate;
jsonArray.append(jsonObj); jsonArray.append(jsonObj);

View File

@ -25,7 +25,7 @@ private:
double _atmosphere; double _atmosphere;
double _heatingRate; double _heatingRate;
struct TheoryData{ struct TheoryData{
QString sampleName; QString elementName;
double temperature; double temperature;
double rate; double rate;
}; };

View File

@ -12,7 +12,7 @@ InstrumentCoefficientForm::InstrumentCoefficientForm(QWidget *parent) :
ui->LineEditCoefficient->setText( ui->LineEditCoefficient->setText(
QString::number( QString::number(
ConfigHandler::_configMap[ConInstrumentCoefficientStr].toFloat(), ConfigHandler::_configMap[ConfigHandler::ConInstrumentCoefficientStr].toFloat(),
'f',3)); 'f',3));
ui->LineEditTheory->text().clear(); ui->LineEditTheory->text().clear();
@ -30,7 +30,7 @@ void InstrumentCoefficientForm::on_pushButtonCalculate_clicked()
float measure = ui->LineEditActualMeasurement->text().toFloat(); float measure = ui->LineEditActualMeasurement->text().toFloat();
float instrumentCoefficient = theory/measure; float instrumentCoefficient = theory/measure;
ConfigHandler::_configMap[ConInstrumentCoefficientStr] = instrumentCoefficient; ConfigHandler::_configMap[ConfigHandler::ConInstrumentCoefficientStr] = instrumentCoefficient;
ConfigHandler::writer(); ConfigHandler::writer();
ui->LineEditCoefficient->setText(QString::number(instrumentCoefficient,'f',3)); ui->LineEditCoefficient->setText(QString::number(instrumentCoefficient,'f',3));