Changeset 15454
- Timestamp:
- 04/28/13 11:30:11 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/scripts/Main.js
r15411 r15454 137 137 } 138 138 139 140 // ================================================================ 141 // Code related to taking data 142 // ================================================================ 143 139 144 var sub_connections = new Subscription("FAD_CONTROL/CONNECTIONS"); 140 145 141 /** 142 * call-back function of FAD_CONTROL/CONNECTIONS 143 * store IDs of problematic FADs 144 * 145 */ 146 /* 147 sub_connections.onchange = function(evt) 148 { 149 // This happens, but why? 150 if (!evt.obj['status']) 151 return; 152 153 this.reset = [ ]; 154 155 for (var x=0; x<40; x++) 156 if (evt.obj['status'][x]!=66 && evt.obj['status'][x]!=67) 157 this.reset.push(x); 158 159 if (this.reset.length==0) 160 return; 161 162 //m.alarm("FAD board loss detected..."); 163 dim.send("MCP/RESET"); 164 dim.send("FAD_CONTROL/CLOSE_OPEN_FILES"); 165 } 166 */ 146 var startrun = new Subscription("FAD_CONTROL/START_RUN"); 147 startrun.get(5000); 167 148 168 149 /** … … 184 165 * exit(); 185 166 */ 186 sub_connections.reconnect = function()187 {188 // this.reset is a list containing the IDs of FADs,189 // which have neither CONNECTION==66 nor ==67, whatever this means :-)190 if (this.reset.length==0)191 return true;192 193 console.out(" Reconnect: start ["+this.reset.length+"]");194 195 for (var i=0; i<this.reset.length; i++)196 dim.send("FAD_CONTROL/DISCONNECT", this.reset[i]);197 198 v8.sleep(3000);199 200 while (this.reset.length)201 dim.send("FAD_CONTROL/CONNECT", this.reset.pop());202 203 v8.sleep(1000);204 dim.wait("FAD_CONTROL", "Connected", 3000);205 206 console.out(" Reconnect: end");207 208 return true;209 }210 211 // ================================================================212 // Code related to taking data213 // ================================================================214 215 var startrun = new Subscription("FAD_CONTROL/START_RUN");216 startrun.get(5000);217 218 167 function reconnect(list, txt) 219 168 { /* … … 264 213 var nextrun = startrun.get().obj['next']; 265 214 console.out(" Take run %3d".$(nextrun)+": N="+count+" T="+time+"s ["+type+"]"); 266 267 incomplete = 0;268 269 dim.send("MCP/START", time?time:-1, count?count:-1, type);270 215 271 216 // FIXME: Replace by callback? … … 308 253 // Here we could check and handle fad losses 309 254 255 incomplete = 0; 256 310 257 for (var n=0; n<3; n++) 311 258 { 259 dim.send("MCP/START", time?time:-1, count?count:-1, type); 312 260 try 313 261 { 314 262 dim.wait("MCP", "TakingData", 15000); 263 break; 315 264 } 316 265 catch (e) … … 346 295 reconnect(list, "configuration"); 347 296 348 if (n<2)297 /*if (n<2) 349 298 return false; 350 299 351 throw e; 300 throw e; 301 */ 302 303 if (n==2) 304 throw e; 352 305 } 353 306 } … … 879 832 { 880 833 var n = new Date(); 881 if ( test==-1)834 if (observations.length>0 && test==-1) 882 835 console.out(n.toUTCString()+": First observation scheduled for "+observations[0].start.toUTCString()); 883 836 if (test>=0 && test<observations.length) 884 837 console.out(n.toUTCString()+": First observation should start immediately."); 885 if (observations [0].start>n+12*3600*1000)838 if (observations.length>0 && observations[0].start>n+12*3600*1000) 886 839 console.out(n.toUTCString()+": No observations scheduled for the next 12 hours!"); 840 if (observations.length==0) 841 console.out(n.toUTCString()+": No observations scheduled!"); 887 842 } 888 843
Note:
See TracChangeset
for help on using the changeset viewer.