Changeset 17324 for trunk/FACT++/scripts
- Timestamp:
- 11/19/13 18:45:35 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/scripts/Main.js
r17190 r17324 115 115 } 116 116 117 dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2);117 dim.send("FAD_CONTROL/SET_FILE_FORMAT", 6); 118 118 119 119 while (!irq && !takeRun("drs-pedestal", 1000)); // 40 / 20s (50Hz) … … 127 127 } 128 128 129 dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2);129 dim.send("FAD_CONTROL/SET_FILE_FORMAT", 6); 130 130 131 131 while (!irq && !takeRun("pedestal", 1000)); // 40 / 10s (80Hz) … … 222 222 223 223 224 this.ok = cnt ==0;// || (this.last!=undefined && Math.abs(this.last-avg)<0.002);225 226 console.out(" DeltaUov=%.3f (%.3f) [N(>0.033V)=%d]".$(avg, Math.abs(this.last-avg), cnt));224 this.ok = cnt<3;// || (this.last!=undefined && Math.abs(this.last-avg)<0.002); 225 226 console.out(" DeltaUov=%.3f (%.3f) [N(>0.033V)=%d]".$(avg, avg-this.last, cnt)); 227 227 228 228 this.last = avg; … … 244 244 { 245 245 dim.log("Switching voltage off."); 246 247 if (dim.state("FTM_CONTROL").name=="TriggerOn") 248 { 249 dim.send("FTM_CONTROL/STOP_TRIGGER"); 250 dim.wait("FTM_CONTROL", "Valid", 3000); 251 } 246 252 247 253 // Supress the possibility that the bias control is … … 250 256 dim.send("FEEDBACK/STOP"); 251 257 dim.wait("FEEDBACK", "Calibrated", 3000); 258 259 // Make sure we are not in Ramping anymore 260 dim.wait("BIAS_CONTROL", "VoltageOn", 3000); 252 261 253 262 // Switch voltage off … … 285 294 // For convenience. 286 295 287 service_feedback.voltageOn = function() 288 { 289 //if (Sun.horizon("FACT").isUp) 290 // throw new Error("Sun is above FACT-horizon, voltage cannot be switched on."); 291 292 var isOff = dim.state("BIAS_CONTROL").name=="VoltageOff"; 296 service_feedback.voltageOn = function(ov) 297 { 298 if (isNaN(ov)) 299 ov = 1.1; 300 301 if (this.ov!=ov && dim.state("FEEDBACK").name=="InProgress") 302 { 303 dim.log("Stoping feedback."); 304 if (dim.state("FTM_CONTROL").name=="TriggerOn") 305 { 306 dim.send("FTM_CONTROL/STOP_TRIGGER"); 307 dim.wait("FTM_CONTROL", "Valid", 3000); 308 } 309 310 dim.send("FEEDBACK/STOP"); 311 dim.wait("FEEDBACK", "Calibrated", 3000); 312 313 // Make sure we are not in Ramping anymore 314 dim.wait("BIAS_CONTROL", "VoltageOn", 3000); 315 } 316 317 var isOff = dim.state("FEEDBACK").name=="Calibrated"; 293 318 if (isOff) 294 319 { 295 dim.log("Switching voltage on.");296 297 dim.send("FEEDBACK/START", 1.1);320 dim.log("Switching voltage to Uov="+ov+"V."); 321 322 dim.send("FEEDBACK/START", ov); 298 323 dim.wait("FEEDBACK", "InProgress", 45000); 324 325 this.ov = ov; 299 326 } 300 327 301 328 // Wait until voltage on 302 329 dim.wait("BIAS_CONTROL", "VoltageOn", 60000); // FIXME: 30000? 303 304 // if (isOff)305 // this.ok = false;306 330 } 307 331 … … 340 364 var now1 = new Date(); 341 365 342 service_feedback.voltageOff(); 343 CloseLid(); 366 var bias = dim.state("BIAS_CONTROL").name; 367 if (bias=="VoltageOn" || bias=="Ramping") 368 service_feedback.voltageOn(0); 369 370 CloseLid(); 344 371 345 372 var now2 = new Date(); … … 369 396 370 397 v8.timeout(150000, func); 398 399 /* 400 // Check if DRS calibration is necessary 401 var diff = getTimeSinceLastDrsCalib(); 402 if (diff>30 || diff==null) 403 { 404 doDrsCalibration("singlepe"); // will turn voltage off 405 if (irq) 406 break; 407 }*/ 408 409 dim.log("Taking single-pe run."); 410 411 // The voltage must be on 412 service_feedback.voltageOn(); 413 service_feedback.waitForVoltageOn(); 414 415 // Before we can switch to 3000 we have to make the right DRS calibration 416 dim.log("Taking single p.e. run."); 417 while (!irq && !takeRun("single-pe", 10000)); 418 419 // It is unclear what comes next, so we better switch off the voltage 420 service_feedback.voltageOff(); 421 422 dim.log("Finishing shutdown."); 371 423 372 424 var now3 = new Date(); … … 600 652 // Make sure we will write files 601 653 // ---------------------------------------------------------------- 602 dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2);654 dim.send("FAD_CONTROL/SET_FILE_FORMAT", 6); 603 655 604 656 // ---------------------------------------------------------------- … … 856 908 break; 857 909 910 case "OVTEST": 911 dim.send("DRIVE_CONTROL/PARK"); 912 dim.send("FEEDBACK/STOP"); 913 914 // The lid must be closes 915 CloseLid(); 916 917 console.out("Waiting for telescope to park. This may take a while."); 918 dim.wait("DRIVE_CONTROL", "Locked", 3000); 919 920 // Check if DRS calibration is necessary 921 var diff = getTimeSinceLastDrsCalib(); 922 if (diff>30 || diff==null) 923 { 924 doDrsCalibration("ovtest"); // will turn voltage off 925 if (irq) 926 break; 927 } 928 929 // The voltage must be on 930 service_feedback.voltageOn(0.4); 931 service_feedback.waitForVoltageOn(); 932 933 dim.log("Taking single p.e. run (0.4V)"); 934 while (!irq && !takeRun("single-pe", 10000)); 935 936 for (var i=5; i<18; i++) 937 { 938 dim.send("FEEDBACK/STOP"); 939 dim.wait("FEEDBACK", "Calibrated", 3000); 940 dim.wait("BIAS_CONTROL", "VoltageOn", 3000); 941 dim.send("FEEDBACK/START", i*0.1); 942 dim.wait("FEEDBACK", "InProgress", 45000); 943 dim.wait("BIAS_CONTROL", "VoltageOn", 60000); // FIXME: 30000? 944 service_feedback.waitForVoltageOn(); 945 dim.log("Taking single p.e. run ("+(i*0.1)+"V)"); 946 while (!irq && !takeRun("single-pe", 10000)); 947 } 948 949 // It is unclear what comes next, so we better switch off the voltage 950 service_feedback.voltageOff(); 951 dim.log("Task finished [OVTEST]"); 952 console.out(""); 953 break; 954 858 955 case "RATESCAN": 859 956 var tm1 = new Date(); … … 867 964 OpenLid(); 868 965 869 // The voltage must be switched on870 service_feedback.voltageOn( );966 // Switch the voltage to a reduced level (Ubd) 967 service_feedback.voltageOn(0); 871 968 872 969 if (obs.source != undefined) … … 883 980 dim.wait("DRIVE_CONTROL", "OnTrack", 150000); // 110s for turning and 30s for stabilizing 884 981 982 // Now tracking stable, switch voltage to nominal level and wait 983 // for stability. 984 service_feedback.voltageOn(); 885 985 service_feedback.waitForVoltageOn(); 886 986 … … 901 1001 // after the Ratescan, no data is written to disk. I don't know why, but it happens all the time 902 1002 // So I decided to put this line here as a kind of patchwork.... 903 //dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2);1003 //dim.send("FAD_CONTROL/SET_FILE_FORMAT", 6); 904 1004 905 1005 dim.log("Ratescan done [%.1fs, %.1fs]".$((tm2-tm1)/1000, (new Date()-tm2)/1000)); … … 946 1046 if (point) 947 1047 { 1048 // Switch the voltage to a reduced voltage level 1049 service_feedback.voltageOn(0); 1050 948 1051 // Change wobble position every four runs, 949 1052 // start with alternating wobble positions each day … … 983 1086 OpenLid(); 984 1087 985 986 // voltage must be switched on after the lid is open for the987 // feedback to adapt the voltage properly to the night-sky988 // background light level.989 service_feedback.voltageOn();990 991 1088 // This is now th right time to wait for th drive to be stable 992 1089 dim.wait("DRIVE_CONTROL", "OnTrack", 150000); // 110s for turning and 30s for stabilizing 993 1090 994 // Now we have to be prepared for data-taking: 995 // make sure voltage is on 1091 // Now we are 'OnTrack', so we can ramp to nominal voltage 1092 // and wait for the feedback to get stable 1093 service_feedback.voltageOn(); 996 1094 service_feedback.waitForVoltageOn(); 997 1095
Note:
See TracChangeset
for help on using the changeset viewer.