-
Notifications
You must be signed in to change notification settings - Fork 0
/
Monitor.cpp
130 lines (120 loc) · 3.33 KB
/
Monitor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#include "MainWindow.h"
#include <QFile>
#include <QTextStream>
static int lastETime = -1;
void MainWindow::setLastETime( int let )
{
lastETime = let;
}
void MainWindow::MonSequence( void )
{
if ( mMonUnits.isBusy() )
return;
double monInt = MonIntT->text().toDouble();
if (( MonStage == 5 )&&( monInt > 0 )) { // インターバル時間の指定があるばあい
if ( lastETime > 0 ) { // 前回の計測から指定の時間経っていなければ
// 次の計測ステージ(5)に進まない
if ( (double)( MonTime.elapsed() - lastETime ) / 1000. < monInt )
return;
}
}
switch( MonStage ) {
/*
0: 値の読み出しと表示
1: nct08 を使う時: 計測開始の前準備
それ以外: 計測開始
2: nct08 を使う時: 計測開始
*/
case 0:
mMonUnits.clearStage();
MonStage = 1;
break;
case 1:
if ( mMonUnits.init() == false ) { // true :: initializing
mMonUnits.clearStage();
MonStage = 2;
}
break;
case 2:
mMonUnits.setDwellTime();
if ( mMonUnits.isParent() ) {
MonStage = 3;
} else {
MonStage = 4;
}
break;
case 3:
if ( mMonUnits.getValue0() == false ) { // only for counters and SSDs
mMonUnits.clearStage();
MonStage = 4;
}
break;
case 4:
if ( mMonUnits.getValue() == false ) { // true :: Getting
mMonUnits.clearStage();
MonStage = 5;
}
break;
case 5:
int etime;
mMonUnits.readValue( MeasVals, MeasCPSs, false ); // false :: not correct dark
MonitorView->NewPointR( etime = MonTime.elapsed(),
MeasVals, mMonUnits.count() );
MonitorView->update();
lastETime = etime;
if ( conds->isRecordAllSSDChs() ) {
if ( SFluo != NULL ) {
QFile f( "ssd.dat" );
f.open( QIODevice::Append | QIODevice::Text );
QTextStream out( &f );
QVector<quint64> CinROI = SFluo->getCountsInROI();
QVector<quint64> CAll = SFluo->getCountsAll();
QVector<quint64> TotalE = SFluo->getCountsAll();
QVector<double> ICRs = SFluo->getICRs();
QString buf;
out << T->elapsed();
for ( int i = 0; i < CinROI.count(); i++ )
buf += QString( " %1" ).arg( CinROI[i] );
for ( int i = 0; i < CAll.count(); i++ )
buf += QString( " %1" ).arg( CAll[i] );
for ( int i = 0; i < TotalE.count(); i++ )
buf += QString( " %1" ).arg( TotalE[i] );
for ( int i = 0; i < ICRs.count(); i++ )
buf += QString( " %1" ).arg( ICRs[i] );
out << buf << "\n";
f.close();
}
}
if ( monRecF ) {
MonFile.setFileName( MonRecFile->text() );
if ( MonFile.open( QIODevice::Append | QIODevice::Text ) ) {
MonOut.setDevice( &MonFile );
MonOut << (double)etime/1000;
for ( int i = 0; i < mMonUnits.count(); i++ ) {
MonOut << "\t" << QString( "%1" ).arg( MeasVals[i], 11, 'f', 7 );
}
if ( SLS != NULL )
MonOut << "\t # " << SLS->value();
MonOut << "\t # " << QDateTime::currentDateTime().toString( "yy/MM/dd hh:mm:ss" );
MonOut << "\n";
}
MonFile.close();
}
MonStage = 10;
if ( MinPause ) {
MonStage = 99; // PauseStage
}
// don't break
case 10: // This label is resume point from pausing
MonitorView->update();
if ( !MinPause ) {
MonStage = 3;
}
break;
case 99:
if ( !MinPause ) {
MonStage = 3;
}
break;
}
}