122 lines
2.7 KiB
C++
122 lines
2.7 KiB
C++
#ifndef __GLOBAL_H
|
|
#define __GLOBAL_H
|
|
|
|
#include <qobject.h>
|
|
#include <qfile.h>
|
|
#include <qcustomplot.h>
|
|
|
|
#include "protocol.h"
|
|
#include "analysisoperationrecorder.h"
|
|
|
|
namespace Global {
|
|
const QString ExperimentDirPath = QDir::currentPath()+"/../experiment_data";
|
|
|
|
const QString SampleDataFloder = ExperimentDirPath + "/sample_data";
|
|
const QString BaseLineFolder = ExperimentDirPath + "/base_line";
|
|
const QString AnalysisStateFolder = ExperimentDirPath + "/analysis_state";
|
|
|
|
const QString CurveOfTimeTypeObjectName("curve_time");
|
|
|
|
// json string.
|
|
const QString AtomsphereData("atomsphereData");
|
|
const QString SampleData("sampleData");
|
|
|
|
const QString Atmosphere("atmosphere");
|
|
const QString HeatingRate("heatingRate");
|
|
|
|
const QString SampleName("sampleName");
|
|
const QString TemperatureStr("temperature");
|
|
const QString RateStr("rate");
|
|
|
|
//
|
|
const double DefaultParamter = 8.177;
|
|
|
|
//
|
|
enum Mode{
|
|
None,
|
|
Analysis,
|
|
ConnectedToDev,
|
|
DeliveredData,
|
|
Experiment
|
|
};
|
|
|
|
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;
|
|
QCPCurve * curve;
|
|
};
|
|
|
|
struct CurveFileData{
|
|
QString fileName;
|
|
Global::ExperimentInfo ei;
|
|
QVector<Global::PhaseTotalInfo> phaseTotalVtr;
|
|
QVector<AnalysisOperationRecorder::AnalysisOperation> analysisOperationVtr;
|
|
};
|
|
|
|
struct CurveExperimentData{
|
|
QCPCurve * curve;
|
|
QString fileName; // discard
|
|
QVector<Global::ExperimentData> dataVtr;
|
|
};
|
|
|
|
// Soft mode.
|
|
extern Mode _mode;
|
|
// Xlsx file data.
|
|
extern QVector<CurveFileData> _curveFileDataVtr;
|
|
// Experiment setting data.
|
|
extern int _currentPhase;
|
|
extern ExperimentInfo _experimentInfo;
|
|
extern QVector<CurveExperimentData> _curveExperimentDataVtr;
|
|
extern CurveExperimentData* _currentCurveExperimentDataPtr;
|
|
|
|
// Call clear function at the right time.
|
|
void clearExperimentData();
|
|
|
|
// Instrument coefficient.
|
|
extern bool _enthalpyCoefficientEnableFlag;
|
|
///abc
|
|
extern QVector<double> _enthalpyCoefficientVtr;
|
|
// peak comprehensive ananlysis
|
|
extern bool _displayTimeValue;
|
|
|
|
// common func
|
|
QString converDoubleToStr(const double);
|
|
void quadraticLeastSquaresFit(double x[], double y[], int n, double coeff[]);
|
|
double findNegativeStartPoint(double m, double b, double start, double end);
|
|
|
|
};
|
|
|
|
#endif // GLOBAL_H
|