Changeset 15146 for trunk/FACT++
- Timestamp:
- 03/25/13 09:32:47 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/scripts/Main.js
r15137 r15146 29 29 // ---------------------------------------------------------------- 30 30 31 dimctrl.defineState(37, "TimeOutBeforeTakingData", "MCP took more than 5minutes to start TakingData");31 //dimctrl.defineState(37, "TimeOutBeforeTakingData", "MCP took more than 5minutes to start TakingData"); 32 32 33 33 … … 185 185 dim.send("MCP/START", time?time:-1, count?count:-1, type); 186 186 187 // What could be a reasonable timeout here?188 187 // FIXME: Replace by callback? 189 188 // … … 216 215 // 217 216 218 if (!dim.wait("MCP", "TakingData", -300000) ) 219 { 220 console.out("MCP took longer than 5 minutes to start TakingData"); 221 console.out("maybe this idicates a problem with one of the FADs?"); 222 dimctrl.setState(37); 223 dim.wait("MCP", "TakingData", 500); 224 } 225 dim.wait("MCP", "Idle"); 217 // Use this if you use the rate control to calibrate by rates 218 //if (!dim.wait("MCP", "TakingData", -300000) ) 219 //{ 220 // throw new Error("MCP took longer than 5 minutes to start TakingData"+ 221 // "maybe this idicates a problem with one of the FADs?"); 222 //} 223 224 // Here we could check and handle fad losses 225 try 226 { 227 dim.wait("MCP", "TakingData", 15000); 228 } 229 catch (e) 230 { 231 if (dim.state("MCP").name=="Configuring3" && 232 dim.state("FAD_CONTROL").name=="Configuring2") 233 { 234 conssole.out(""); 235 conssole.out("Waiting for fadctrl to get configured timed out... checking for FAD loss."); 236 conssole.out(""); 237 238 var con = service_con.get(); 239 var stat = con.obj['status']; 240 241 var reset = [ ]; 242 243 for (var i=0; i<40; i++) 244 if (stat[i]!=0x43) 245 { 246 console.out(" FAD %2d".$(i)+" not in Configured state."); 247 reset.push(i/10); 248 } 249 250 reset = reset.filter(function(elem,pos){return reset.indexOf(elem)==pos;}); 251 252 if (reset.length>0) 253 { 254 console.out(""); 255 console.out(" FADs belong to crates "+reset); 256 } 257 } 258 259 dim.send("MCP/RESET"); 260 261 // If it works, we can decide here what to do... 262 263 throw e; 264 } 265 266 if (time>0) 267 dim.wait("MCP", "Idle", time*1250); // run time plus 25% 268 else 269 dim.wait("MCP", "Idle"); 226 270 227 271 //console.out(" Take run: end"); … … 271 315 } 272 316 273 dim.send("RATE_CONTROL/STOP"); // get out of GlobalThresholdSet274 dim.wait("RATE_CONTROL", "Connected", 3000);317 //dim.send("RATE_CONTROL/STOP"); // get out of GlobalThresholdSet 318 //dim.wait("RATE_CONTROL", "Connected", 3000); 275 319 276 320 //console.out(" DRS cal: end"); … … 470 514 console.out(" Feedback wait: start"); 471 515 516 function func(service) 517 { 518 if ((service.cnt!=undefined && service.get().counter>service.cnt+10) || 519 (service.voltageStep && service.voltageStep<0.02)) 520 return true; 521 } 522 472 523 var now = new Date(); 473 //v8.timeout( 90000, function() { if (!(this.cnt==undefined || this.get().counter<=this.cnt+2)) return true; });524 //v8.timeout(5*60000, func, this); 474 525 while ((this.cnt==undefined || this.get().counter<=this.cnt+10) && (!this.voltageStep || this.voltageStep>0.02)) 475 526 v8.sleep(); … … 601 652 } 602 653 654 var now = new Date(); 603 655 v8.timeout(150000, func); 604 656 605 // FIXME: Add a check for the position here! 606 607 console.out("Shutdown: end"); 657 var report = sub.get(); 658 659 console.out(""); 660 console.out("Shutdown procedure seems to be finished..."); 661 console.out(" Telescope at Zd="+report.obj['Zd']+"deg Az="+report.obj['Az']+"deg"); 662 console.out(" Please make sure the park position was reached"); 663 console.out(" and the telescope is not moving anymore."); 664 console.out(" Please check that the lid is closed and the voltage switched off."); 665 console.out(""); 666 console.out("Shutdown: end ["+(new Date()-now)/1000+"s]"); 608 667 } 609 668 … … 708 767 continue; 709 768 } 710 // add time 769 711 770 console.out("\n"+(new Date()).toUTCString()+": Current measurement: "+obs[sub]); 712 771 … … 732 791 service_feedback.voltageOff(); 733 792 734 dim.send("RATE_CONTROL/STOP"); // get out of GlobalThresholdSet735 dim.wait("RATE_CONTROL", "Connected", 3000);793 //dim.send("RATE_CONTROL/STOP"); // get out of GlobalThresholdSet 794 //dim.wait("RATE_CONTROL", "Connected", 3000); 736 795 737 796 console.out(" Waiting for first scheduled observation.",""); … … 751 810 continue; 752 811 812 case "DRSCALIB": 813 console.out(" DRSCALIB", ""); 814 815 console.out(" Take DRS calibration [drscalib]"); 816 doDrsCalibration(); // -> VoltageOff 817 console.out(" DRS calibration done."); 818 819 //dim.send("RATE_CONTROL/STOP"); // get out of GlobalThresholdSet 820 //dim.wait("RATE_CONTROL", "Connected", 3000); 821 822 sub++; 823 continue; 824 825 case "SINGLEPE": 826 827 // FIXME: Check whether a DRS calib is necessary. 828 829 service_feedback.voltageOn(); 830 service_feedback.waitForVoltageOn(); 831 832 // Before we can switch to 3000 we have to make the right DRS calibration 833 console.out(" Take single p.e. run."); 834 while (!takeRun("pedestal", 5000)); 835 836 service_feedback.voltageOff(); 837 838 //dim.send("RATE_CONTROL/STOP"); // get out of GlobalThresholdSet 839 //dim.wait("RATE_CONTROL", "Connected", 3000); 840 841 sub++; 842 continue; 843 753 844 case "RATESCAN": 754 845 console.out(" RATESCAN "); 755 846 /* 756 847 if (dim.state("FTM_CONTROL").name=="TriggerOn") 757 848 { 758 849 dim.send("FTM_CONTROL/STOP_TRIGGER"); 759 850 dim.wait("FTM_CONTROL", "Idle", 3000); 760 } 761 851 }*/ 852 853 // This is a workaround to make sure that we really catch 854 // the new state and not the old one 762 855 dim.send("DRIVE_CONTROL/STOP"); 763 856 dim.wait("DRIVE_CONTROL", "Armed", 5000); … … 794 887 [ "FEEDBACK", [ "CurrentControl" ] ], 795 888 [ "RATE_SCAN", [ "Connected" ] ], 796 [ "RATE_CONTROL", [ "Connected", " InProgress" ] ],889 [ "RATE_CONTROL", [ "Connected", "GlobalThresholdSet", "InProgress" ] ], 797 890 [ "LID_CONTROL", [ "Open" ] ], 798 891 [ "DRIVE_CONTROL", [ "Tracking", "OnTrack" ] ], 799 [ "FTM_CONTROL", [ "Idle", 892 [ "FTM_CONTROL", [ "Idle", "TriggerOn" ] ], 800 893 [ "FAD_CONTROL", [ "Connected", "WritingData" ] ], 801 894 ]; … … 811 904 dim.send("RATE_SCAN/START_THRESHOLD_SCAN", 50, 1000, -10); 812 905 813 // lets wait if the Ratescan really starts .. it should be started after 10sec max. 906 // Lets wait if the ratescan really starts... this might take a few 907 // seconds because RATE_SCAN configures the ftm and is waiting for 908 // it to be configured. 814 909 dim.wait("RATE_SCAN", "InProgress", 10000); 815 910 dim.wait("RATE_SCAN", "Connected", 2700000); … … 818 913 // after the Ratescan, no data is written to disk. I don't know why, but it happens all the time 819 914 // So I decided to put this line here as a kind of patchwork.... 820 dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2);915 //dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2); 821 916 822 917 console.out("Ratescan done."); … … 860 955 [ "FEEDBACK", [ "CurrentCtrlIdle", "CurrentControl" ] ], 861 956 [ "RATE_SCAN", [ "Connected" ] ], 862 [ "RATE_CONTROL", [ "Connected", " InProgress"] ],957 [ "RATE_CONTROL", [ "Connected", "GlobalThresholdSet", "InProgress" ] ], 863 958 [ "LID_CONTROL", [ "Open", "Closed" ] ], 864 959 [ "DRIVE_CONTROL", [ "Armed", "Tracking", "OnTrack" ] ],
Note:
See TracChangeset
for help on using the changeset viewer.