Changeset 17179 for trunk/FACT++/scripts
- Timestamp:
- 09/19/13 16:16:08 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/scripts/Main.js
r17174 r17179 221 221 return; 222 222 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)); 227 228 this.last = avg; 229 } 230 223 this.ok = cnt==0; 224 225 console.out(" DeltaUov=%.3f [N(>0.033V)=%d]".$(avg, cnt)); 226 } 227 228 // DN: Why is voltageOff() implemented as 229 // a method of a Subscription to a specific Service 230 // I naively would think of voltageOff() as an unbound function. 231 // I seems to me it has to be a method of a Subscription object, in order 232 // to use the update counting method. But does it have to be 233 // a Subscription to FEEDBACK/DEVIATION, or could it work with other services as well? 231 234 service_feedback.voltageOff = function() 232 235 { … … 244 247 { 245 248 dim.log("Switching voltage off."); 249 250 this.ok = undefined; 246 251 247 252 // Supress the possibility that the bias control is … … 255 260 } 256 261 257 dim.wait("BIAS_CONTROL", "VoltageOff", 60000); // FIXME: 30000?262 dim.wait("BIAS_CONTROL", "VoltageOff", 60000); 258 263 259 264 // FEEDBACK stays in CurrentCtrl when Voltage is off but output enabled … … 300 305 301 306 // Wait until voltage on 302 dim.wait("BIAS_CONTROL", "VoltageOn", 60000); // FIXME: 30000?303 304 //if (isOff)305 //this.ok = false;307 dim.wait("BIAS_CONTROL", "VoltageOn", 60000); 308 309 if (isOff) 310 this.ok = false; 306 311 } 307 312 … … 319 324 var now = new Date(); 320 325 321 this.last = undefined; 322 this.ok = false; 323 v8.timeout(4*60000, func, this); // FIMXE: Remove 4! 324 this.ok = undefined; 326 v8.timeout(60000, func, this); 325 327 326 328 if (irq) … … 328 330 else 329 331 dim.log("Voltage stable within limits"); 332 333 this.ok = undefined; 330 334 } 331 335 … … 374 378 //dim.send("FEEDBACK/STOP"); 375 379 dim.send("FTM_CONTROL/STOP_TRIGGER"); 380 dim.send("BIAS_CONTROL/DISCONNECT"); 376 381 377 382 dim.wait("FTM_CONTROL", "Valid", 3000); 383 dim.wait("BIAS_CONTROL", "Disconnected", 3000); 378 384 dim.wait("FEEDBACK", "Calibrated", 3000); 379 380 dim.send("BIAS_CONTROL/DISCONNECT");381 dim.wait("BIAS_CONTROL", "Disconnected", 3000);382 385 383 386 var report = sub.get(); … … 803 806 while (!irq && !takeRun("single-pe", 10000)); 804 807 805 /*806 // =================== new feedback ======================807 dim.log("Switching to new bias calibration and feedback.");808 dim.send("BIAS_CONTROL/EXPERT_MODE", true);809 dim.wait("BIAS_CONTROL", "ExpertMode", 3000);810 dim.send("BIAS_CONTROL/EXPERT_LOAD_MAP_FILE", "/home/fact/operation/GAPDmap_with_spare_module-new2.txt");811 dim.send("BIAS_CONTROL/EXPERT_MODE", false);812 dim.wait("BIAS_CONTROL", "VoltageOn", 3000);813 dim.send("FEEDBACK/STOP");814 dim.wait("FEEDBACK", "Calibrated", 3000);815 dim.send("FEEDBACK/ENABLE_OLD_ALGORITHM", false);816 dim.send("FEEDBACK/START", 1.1);817 dim.wait("FEEDBACK", "InProgress", 45000);818 service_feedback.voltageOn();819 service_feedback.waitForVoltageOn();820 821 v8.sleep(60000);822 dim.log("Taking single p.e. run.");823 while (!irq && !takeRun("single-pe", 10000));824 825 dim.send("FEEDBACK/STOP");826 dim.wait("FEEDBACK", "Calibrated", 3000);827 dim.send("FEEDBACK/ENABLE_TEMP_OFFSETS", true);828 dim.send("FEEDBACK/START", 1.1);829 dim.wait("FEEDBACK", "InProgress", 45000);830 service_feedback.voltageOn();831 service_feedback.waitForVoltageOn();832 833 v8.sleep(60000);834 dim.log("Taking single p.e. run.");835 while (!irq && !takeRun("single-pe", 10000));836 */837 // =======================================================838 839 808 // It is unclear what comes next, so we better switch off the voltage 840 809 service_feedback.voltageOff(); 841 842 /*843 // =============== Switch back to old feedback =============844 dim.log("Switching to old bias calibration and feedback.");845 dim.send("BIAS_CONTROL/EXPERT_MODE", true);846 dim.wait("BIAS_CONTROL", "ExpertMode", 3000);847 dim.send("BIAS_CONTROL/EXPERT_LOAD_MAP_FILE", "/home/fact/operation/GAPDmap_with_spare_module-new.txt");848 dim.send("BIAS_CONTROL/EXPERT_MODE", false);849 dim.wait("BIAS_CONTROL", "VoltageOff", 3000);850 dim.send("FEEDBACK/ENABLE_OLD_ALGORITHM", true);851 dim.send("FEEDBACK/ENABLE_TEMP_OFFSETS", false);852 // =========================================================853 */854 855 810 system_on = true; 856 811 dim.log("Task finished [STARTUP]"); … … 954 909 console.out(""); 955 910 break; // case "RATESCAN" 956 /* 957 case "FEEDBACK-TEST": 958 // ----------------- Enable new feedback --------------- 959 service_feedback.voltageOff(); 960 dim.log("Switching to new bias calibration and feedback."); 961 dim.send("BIAS_CONTROL/EXPERT_MODE", true); 962 dim.wait("BIAS_CONTROL", "ExpertMode", 3000); 963 dim.send("BIAS_CONTROL/EXPERT_LOAD_MAP_FILE", "/home/fact/operation/GAPDmap_with_spare_module-new2.txt"); 964 dim.send("BIAS_CONTROL/EXPERT_MODE", false); 965 dim.wait("BIAS_CONTROL", "VoltageOff", 3000); 966 dim.send("FEEDBACK/ENABLE_OLD_ALGORITHM", false); 967 968 // ---------------- Take single pe run ------------------ 969 CloseLid(); 970 doDrsCalibration("singlepe"); // will turn voltage off 971 service_feedback.voltageOn(); 972 service_feedback.waitForVoltageOn(); 973 v8.sleep(15000); 974 dim.log("Taking single p.e. run."); 975 while (!irq && !takeRun("single-pe", 10000)); 976 977 dim.send("FEEDBACK/STOP"); 978 dim.wait("FEEDBACK", "Calibrated", 3000); 979 dim.send("FEEDBACK/ENABLE_TEMP_OFFSETS", true); 980 dim.send("FEEDBACK/START", 1.1); 981 dim.wait("FEEDBACK", "InProgress", 45000); 982 service_feedback.voltageOn(); 983 service_feedback.waitForVoltageOn(); 984 v8.sleep(15000); 985 dim.log("Taking single p.e. run."); 986 while (!irq && !takeRun("single-pe", 10000)); 987 988 // ------------------ Ratescan -------------------------- 989 var tm1 = new Date(); 990 991 // This is a workaround to make sure that we really catch 992 // the new OnTrack state later and not the old one 993 dim.send("DRIVE_CONTROL/STOP"); 994 dim.wait("DRIVE_CONTROL", "Armed", 15000); 995 996 // The lid must be open 997 OpenLid(); 998 999 // The voltage must be switched on 1000 service_feedback.voltageOn(); 1001 1002 if (obs.source != undefined) 1003 { 1004 dim.log("Pointing telescope to '"+obs[cub].source+"'."); 1005 dim.send("DRIVE_CONTROL/TRACK_ON", obs[sub].source); 1006 } 1007 else 1008 { 1009 dim.log("Pointing telescope to ra="+obs[sub].ra+" dec="+obs[sub].dec); 1010 dim.send("DRIVE_CONTROL/TRACK", obs[sub].ra, obs[sub].dec); 1011 } 1012 1013 dim.wait("DRIVE_CONTROL", "OnTrack", 150000); // 110s for turning and 30s for stabilizing 1014 1015 service_feedback.waitForVoltageOn(); 1016 1017 var tm2 = new Date(); 1018 1019 dim.log("Starting ratescan."); 1020 1021 // Start rate scan 1022 dim.send("RATE_SCAN/START_THRESHOLD_SCAN", 50, 1000, -10); 1023 1024 // Lets wait if the ratescan really starts... this might take a few 1025 // seconds because RATE_SCAN configures the ftm and is waiting for 1026 // it to be configured. 1027 dim.wait("RATE_SCAN", "InProgress", 10000); 1028 dim.wait("RATE_SCAN", "Connected", 2700000); 1029 1030 // this line is actually some kind of hack. 1031 // after the Ratescan, no data is written to disk. I don't know why, but it happens all the time 1032 // So I decided to put this line here as a kind of patchwork.... 1033 //dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2); 1034 1035 dim.log("Ratescan done [%.1fs, %.1fs]".$((tm2-tm1)/1000, (new Date()-tm2)/1000)); 1036 1037 // ------------------ Switch back -------------------------- 1038 1039 dim.send("BIAS_CONTROL/EXPERT_MODE", true); 1040 dim.wait("BIAS_CONTROL", "ExpertMode", 3000); 1041 dim.send("BIAS_CONTROL/EXPERT_LOAD_MAP_FILE", "/home/fact/operation/GAPDmap_with_spare_module-new.txt"); 1042 dim.send("BIAS_CONTROL/EXPERT_MODE", false); 1043 dim.wait("BIAS_CONTROL", "VoltageOn", 3000); 1044 dim.send("FEEDBACK/STOP"); 1045 dim.wait("FEEDBACK", "Calibrated", 3000); 1046 dim.send("FEEDBACK/ENABLE_OLD_ALGORITHM", true); 1047 dim.send("FEEDBACK/ENABLE_TEMP_OFFSETS", false); 1048 dim.send("FEEDBACK/START", 1.1); 1049 dim.wait("FEEDBACK", "InProgress", 60000); 1050 1051 dim.log("Starting ratescan."); 1052 1053 // Start rate scan 1054 dim.send("RATE_SCAN/START_THRESHOLD_SCAN", 50, 1000, -10); 1055 1056 // Lets wait if the ratescan really starts... this might take a few 1057 // seconds because RATE_SCAN configures the ftm and is waiting for 1058 // it to be configured. 1059 dim.wait("RATE_SCAN", "InProgress", 10000); 1060 dim.wait("RATE_SCAN", "Connected", 2700000); 1061 1062 // this line is actually some kind of hack. 1063 // after the Ratescan, no data is written to disk. I don't know why, but it happens all the time 1064 // So I decided to put this line here as a kind of patchwork.... 1065 //dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2); 1066 1067 dim.log("Ratescan done [%.1fs, %.1fs]".$((tm2-tm1)/1000, (new Date()-tm2)/1000)); 1068 1069 dim.log("Task finished [FEEDBACK-TEST]"); 1070 console.out(""); 1071 break; 1072 1073 case "SINGLEPE-TEST": 1074 // ----------------- Enable new feedback --------------- 1075 service_feedback.voltageOff(); 1076 dim.log("Switching to new bias calibration and feedback."); 1077 dim.send("BIAS_CONTROL/EXPERT_MODE", true); 1078 dim.wait("BIAS_CONTROL", "ExpertMode", 3000); 1079 dim.send("BIAS_CONTROL/EXPERT_LOAD_MAP_FILE", "/home/fact/operation/GAPDmap_with_spare_module-new2.txt"); 1080 dim.send("BIAS_CONTROL/EXPERT_MODE", false); 1081 dim.wait("BIAS_CONTROL", "VoltageOff", 3000); 1082 dim.send("FEEDBACK/ENABLE_OLD_ALGORITHM", false); 1083 1084 // ---------------- Take single pe run ------------------ 1085 CloseLid(); 1086 doDrsCalibration("singlepe"); // will turn voltage off 1087 dim.send("FEEDBACK/STOP"); 1088 dim.wait("FEEDBACK", "Calibrated", 3000); 1089 dim.send("FEEDBACK/ENABLE_TEMP_OFFSETS", true); 1090 dim.send("FEEDBACK/START", 1.1); 1091 dim.wait("FEEDBACK", "InProgress", 45000); 1092 service_feedback.voltageOn(); 1093 service_feedback.waitForVoltageOn(); 1094 v8.sleep(15000); 1095 dim.log("Taking single p.e. run."); 1096 while (!irq && !takeRun("single-pe", 10000)); 1097 1098 // ------------------ Switch back -------------------------- 1099 dim.send("BIAS_CONTROL/EXPERT_MODE", true); 1100 dim.wait("BIAS_CONTROL", "ExpertMode", 3000); 1101 dim.send("BIAS_CONTROL/EXPERT_LOAD_MAP_FILE", "/home/fact/operation/GAPDmap_with_spare_module-new.txt"); 1102 dim.send("BIAS_CONTROL/EXPERT_MODE", false); 1103 dim.wait("BIAS_CONTROL", "VoltageOn", 3000); 1104 dim.send("FEEDBACK/STOP"); 1105 dim.wait("FEEDBACK", "Calibrated", 3000); 1106 dim.send("FEEDBACK/ENABLE_OLD_ALGORITHM", true); 1107 dim.send("FEEDBACK/ENABLE_TEMP_OFFSETS", false); 1108 dim.send("FEEDBACK/START", 1.1); 1109 dim.wait("FEEDBACK", "InProgress", 60000); 1110 1111 dim.log("Task finished [SINGLEPE-TEST]"); 1112 console.out(""); 1113 break; 1114 */ 911 1115 912 1116 913 case "DATA":
Note:
See TracChangeset
for help on using the changeset viewer.