-
Notifications
You must be signed in to change notification settings - Fork 0
/
DsDA_20180116.cs
139 lines (126 loc) · 3.83 KB
/
DsDA_20180116.cs
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
130
131
132
133
134
135
136
137
138
139
// before starting this script, ensure that the R script has begun
// and instructed you to start script
// first change directory name to that project in which you are working
// see first line beneath opening bracket
public override void main()
{
string proj=@"C:\Data\20171018-PMF-KWEBB-KW-20_neg2.PRO";
// format directory as below
// string proj=@"C:\Data\WRENS_20170524_final_dsda.PRO";
string datadir=proj+@"\Data";
double idlelimit=3000; // in seconds
double maxtime=1020; // in seconds
int cycletime=100;
int preload=500;
double idletime=0;
connect("epc");
enable_data_capture();
// reset_data();
set_data_capture_range(105, 110, 50);
send_cmd("setQuadConversionFactorV,16.625");
stop_function("WrensStartScan","writePropertyQueueV");
wait(10);
start_function("WrensStartScan","writeQueueV");
maxtime=maxtime-5;
while(idletime < idlelimit)
{
DateTime loopstarttime = DateTime.Now;
string dt = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
string outfile = proj+@"\settings\"+dt+@"_wrens.txt";
string[] olddir = Directory.GetDirectories(datadir);
string[] newdir = Directory.GetDirectories(datadir);
//string dir=olddir[olddir.Length-1];
int o=olddir.Length;
int n=newdir.Length;
print("waiting for new data file");
while (o == n)
{
newdir = Directory.GetDirectories(datadir);
n=newdir.Length;
wait(1000);
DateTime currenttime = DateTime.Now;
idletime = (currenttime - loopstarttime).TotalSeconds;
print("waiting for new file: "+idletime.ToString());
print("n direcories: o "+o.ToString()+" n "+n.ToString());
if(idletime > idlelimit)
{
break;
}
}
if(idletime > idlelimit)
{
print("looping stopped, idlelimit was surpassed");
break;
}
// string dir=newdir[newdir.Length-1];
print("new .raw file written: starting loop");
//print(dir);
string commandfile=proj+@"\settings\active.txt";
string[] commands=System.IO.File.ReadAllLines(commandfile);
System.IO.File.WriteAllLines(outfile, commands);
send_cmd("initPropertyQueueV");
double currentrt = -1;
bool proceed=false;
while(!proceed)
{
wait(100);
string data = get_data();
currentrt = get_retentionTime(data);
// reset_data();
if(currentrt>0 & currentrt <2)
{
proceed=true;
}
DateTime currenttime = DateTime.Now;
idletime = (currenttime - loopstarttime).TotalSeconds;
print("waiting for file start: "+idletime.ToString());
if(idletime > idlelimit)
{
print("looping stopped, idlelimit was surpassed");
break;
}
}
if(idletime > idlelimit)
{
print("looping stopped, idlelimit was surpassed");
break;
}
print(currentrt.ToString());
//start_function("WrensStartScan","writeQueueV");
print("acquisition started, loading queue");
int comlength=commands.Length-1;
for(int x=2; x<comlength ; x++) // from x=2 ; skip lockmass (0) and first MS (1)
{
send_cmd(commands[x].ToString());
if(x>preload)
{
wait(cycletime/6);
//reset_data();
}
}
DateTime loadendtime = DateTime.Now;
idletime = (loadendtime - loopstarttime).TotalSeconds;
// wait(120000);
proceed=false;
while(!proceed)
{
wait(1000);
string data = get_data();
currentrt = get_retentionTime(data);
// reset_data();
print("waiting for file end: retention time = "+currentrt.ToString());
if(currentrt>maxtime | currentrt == 0)
{
proceed=true;
}
}
//wait(10000);
// reset_data();
// disable_data_capture();
// stop_function("WrensStartScan","writeQueueV");
}
send_cmd("initPropertyQueueV");
// reset_data();
disable_data_capture();
stop_function("WrensStartScan","writeQueueV");
}