Changeset 15137 for trunk/FACT++
- Timestamp:
- 03/22/13 17:14:55 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/scripts/Main.js
r15117 r15137 170 170 } 171 171 172 var startrun = new Subscription("FAD_CONTROL/START_RUN"); 173 startrun.get(5000); 174 172 175 function takeRun(type, count, time) 173 176 { … … 177 180 time = -1; 178 181 179 console.out(" Take run: N="+count+" T="+time+"s ["+type+"]"); 182 var nextrun = startrun.get().obj['next']; 183 console.out(" Take run %3d".$(nextrun)+": N="+count+" T="+time+"s ["+type+"]"); 180 184 181 185 dim.send("MCP/START", time?time:-1, count?count:-1, type); … … 221 225 dim.wait("MCP", "Idle"); 222 226 223 console.out(" Take run: end");227 //console.out(" Take run: end"); 224 228 225 229 // DN: currently reconnect() never returns false … … 235 239 function doDrsCalibration() 236 240 { 237 console.out(" DRS cal: start");241 //console.out(" DRS cal: start"); 238 242 service_feedback.voltageOff(); 239 243 … … 270 274 dim.wait("RATE_CONTROL", "Connected", 3000); 271 275 272 console.out(" DRS cal: end");276 //console.out(" DRS cal: end"); 273 277 } 274 278 … … 319 323 320 324 var service_feedback = new Subscription("FEEDBACK/DEVIATION"); 325 326 service_feedback.onchange = function(evt) 327 { 328 if (this.cnt && evt.counter>this.cnt+12) 329 return; 330 331 this.voltageStep = null; 332 if (!evt.obj) 333 return; 334 335 var delta = evt.obj['DeltaBias']; 336 337 var avg = 0; 338 for (var i=0; i<320; i++) 339 avg += delta[i]; 340 avg /= 320; 341 342 if (this.previous) 343 this.voltageStep = Math.abs(avg-this.previous); 344 345 this.previous = avg; 346 347 console.out(" DeltaV="+this.voltageStep); 348 } 321 349 322 350 // DN: Why is voltageOff() implemented as … … 413 441 if (isOff) 414 442 { 443 console.out(" Voltage on: cnt="+this.cnt); 444 445 this.previous = undefined; 415 446 this.cnt = this.get().counter; 416 console.out(" Voltage on: cnt="+this.cnt);447 this.voltageStep = undefined; 417 448 } 418 449 } … … 433 464 434 465 // Avoid output if condition is already fulfilled 435 if (this.cnt && this.get().counter>this.cnt+ 2)466 if (this.cnt && this.get().counter>this.cnt+10) 436 467 return; 437 468 … … 440 471 441 472 var now = new Date(); 442 while (this.cnt==undefined || this.get().counter<=this.cnt+2) 473 //v8.timeout(90000, function() { if (!(this.cnt==undefined || this.get().counter<=this.cnt+2)) return true; }); 474 while ((this.cnt==undefined || this.get().counter<=this.cnt+10) && (!this.voltageStep || this.voltageStep>0.02)) 443 475 v8.sleep(); 444 476 445 console.out(" Feedback wait: end [ cnt=%d, %.2fs]".$(this.get().counter, (new Date()-now)/1000));477 console.out(" Feedback wait: end [dV=%.3f, cnt=%d, %.2fs]".$(this.voltageStep, this.get().counter, (new Date()-now)/1000)); 446 478 } 447 479 … … 547 579 548 580 // FIXME: This might not work is the drive is already close to park position 549 dim.wait("DRIVE_CONTROL", "Moving", 3000); 550 dim.wait("DRIVE_CONTROL", "Armed", 120000); 581 dim.wait("DRIVE_CONTROL", "Locked", 3000); 582 //dim.wait("DRIVE_CONTROL", "Moving", 3000); 583 //dim.wait("DRIVE_CONTROL", "Armed", 120000); 551 584 552 585 // dim.wait("DRIVE_CONTROL", "Locked", 3000); … … 620 653 if (idxObs===undefined) 621 654 exit(); 655 656 // FIXME: Check missing whether a shutdown is needed... 622 657 623 658 // we are still waiting for the first observation in the schedule … … 684 719 CloseLid(); 685 720 686 console.out(" Take DRS calibration .");721 console.out(" Take DRS calibration [startup]"); 687 722 doDrsCalibration(); // -> VoltageOff 723 console.out(" DRS calibration done."); 688 724 689 725 service_feedback.voltageOn(); … … 712 748 713 749 case "IDLE": 714 // FIXME: Checks missing whether a shutdown is needed...715 750 v8.sleep(1000); 716 751 continue; … … 876 911 // Change wobble position every four runs, 877 912 // start with alternating wobble positions each day 878 var wobble = (parseInt(run/4) + parseInt(new Date()/1000/3600/24-0.5))%2 ;913 var wobble = (parseInt(run/4) + parseInt(new Date()/1000/3600/24-0.5))%2+1; 879 914 880 915 //console.out(" Move telescope to '"+source+"' "+offset+" "+wobble); … … 886 921 //dim.send("DRIVE_CONTROL/TRACK_SOURCE", offset, wobble, source); 887 922 888 dim.send("DRIVE_CONTROL/TRACK_WOBBLE", wobble +1, obs[sub].source);923 dim.send("DRIVE_CONTROL/TRACK_WOBBLE", wobble, obs[sub].source); 889 924 890 925 // Do we have to check if the telescope is really moving? … … 894 929 if (drscal) 895 930 { 896 console.out(" Take DRS calibration .");931 console.out(" Take DRS calibration [interleaved]"); 897 932 doDrsCalibration(); // -> VoltageOff 933 console.out(" DRS calibration done."); 898 934 } 899 935
Note:
See TracChangeset
for help on using the changeset viewer.