DSCAnalysisTool/src/global.h

120 lines
2.7 KiB
C
Raw Normal View History

2025-04-12 13:02:37 +00:00
#ifndef __GLOBAL_H
#define __GLOBAL_H
2025-03-12 09:29:52 +00:00
#include <qobject.h>
2025-03-17 13:16:16 +00:00
#include <qfile.h>
2025-04-10 09:33:38 +00:00
#include <qcustomplot.h>
2025-04-13 10:10:29 +00:00
#include "protocol.h"
2025-05-16 09:01:40 +00:00
#include "analysisoperationrecorder.h"
2025-03-12 09:29:52 +00:00
2025-04-14 09:11:01 +00:00
namespace Global {
2025-04-15 08:03:00 +00:00
const QString ExperimentDirPath = QDir::currentPath()+"/../experiment_data";
2025-04-24 08:41:20 +00:00
2025-04-15 08:03:00 +00:00
const QString SampleDataFloder = ExperimentDirPath + "/sample_data";
const QString BaseLineFolder = ExperimentDirPath + "/base_line";
const QString AnalysisStateFolder = ExperimentDirPath + "/analysis_state";
2025-04-28 09:31:29 +00:00
const QString CurveOfTimeTypeObjectName("curve_time");
2025-05-07 09:33:03 +00:00
// json string.
const QString AtomsphereData("atomsphereData");
const QString SampleData("sampleData");
2025-04-30 02:59:08 +00:00
2025-05-07 09:33:03 +00:00
const QString Atmosphere("atmosphere");
const QString HeatingRate("heatingRate");
2025-04-30 02:59:08 +00:00
2025-05-07 09:33:03 +00:00
const QString SampleName("sampleName");
const QString TemperatureStr("temperature");
const QString RateStr("rate");
//
2025-05-20 09:30:02 +00:00
const double DefaultParamter = 8.177;
2025-05-07 09:33:03 +00:00
//
2025-04-14 09:11:01 +00:00
enum Mode{
Analysis,
ConnectedToDev,
DeliveredData,
2025-04-22 08:59:26 +00:00
Experiment
2025-04-14 09:11:01 +00:00
};
enum DeviceConnectionStatus{
Disconnected,
Connected
};
struct ExperimentData {
float runTime;
float constantTempTime;
float sampleTemp;
float dsc;
};
enum TestType{
OIT,
NoneOIT
};
struct ExperimentInfo{
// experiment info
QString sampleName;
QString sampleWeight;
QString date;
QString experimentor;
// phase info
TestType testType;
GasType initialAtmosPhere;
int phaseSize;
QVector<Phase> phaseVtr;
};
struct PhaseTotalInfo{
int phaseIndex; // from 1 to 6.
Phase phase;
QVector<ExperimentData> dataVtr;
2025-04-15 08:03:00 +00:00
QCPCurve * curve;
2025-04-14 09:11:01 +00:00
};
2025-04-15 08:03:00 +00:00
struct CurveFileData{
2025-05-16 09:28:45 +00:00
QString fileName;
2025-04-15 08:03:00 +00:00
Global::ExperimentInfo ei;
QVector<Global::PhaseTotalInfo> phaseTotalVtr;
2025-05-16 09:28:45 +00:00
QVector<AnalysisOperationRecorder::AnalysisOperation> analysisOperationVtr;
2025-04-15 08:03:00 +00:00
};
struct CurveExperimentData{
QCPCurve * curve;
2025-04-28 09:31:29 +00:00
QString fileName; // discard
2025-04-15 08:03:00 +00:00
QVector<Global::ExperimentData> dataVtr;
};
// Soft mode.
2025-04-14 09:11:01 +00:00
extern Mode _mode;
2025-04-15 08:03:00 +00:00
// Xlsx file data.
extern QVector<CurveFileData> _curveFileDataVtr;
// Experiment setting data.
2025-04-23 07:33:39 +00:00
extern int _currentPhase;
2025-04-15 08:03:00 +00:00
extern ExperimentInfo _experimentInfo;
extern QVector<CurveExperimentData> _curveExperimentDataVtr;
2025-04-23 07:33:39 +00:00
extern CurveExperimentData* _currentCurveExperimentDataPtr;
2025-04-18 09:30:35 +00:00
2025-05-16 09:01:40 +00:00
// Call this function at the right time.
2025-05-15 09:31:03 +00:00
void clearExperimentData();
2025-04-22 08:59:26 +00:00
// Instrument coefficient.
2025-04-18 09:30:35 +00:00
extern bool _enthalpyCoefficientEnableFlag;
2025-04-22 08:59:26 +00:00
///abc
2025-04-18 09:30:35 +00:00
extern QVector<double> _enthalpyCoefficientVtr;
2025-04-30 02:59:08 +00:00
// peak comprehensive ananlysis
extern bool _displayTimeValue;
2025-04-18 09:30:35 +00:00
2025-04-29 09:29:14 +00:00
// common func
QString converDoubleToStr(const double);
2025-05-09 09:28:39 +00:00
void quadraticLeastSquaresFit(double x[], double y[], int n, double coeff[]);
double findNegativeStartPoint(double m, double b, double start, double end);
2025-05-14 09:30:52 +00:00
};
2025-03-12 09:29:52 +00:00
#endif // GLOBAL_H