- Timestamp:
- 03/15/13 13:46:40 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/scripts/Startup.js
r14996 r15082 44 44 45 45 console.out(""); 46 dim.alarm(); 46 47 47 48 var loop; … … 175 176 dim.send("PWR_CONTROL/TOGGLE_DRIVE"); 176 177 } 177 include("scripts/handleDriveArmed.js"); 178 179 checkSend(["DRIVE_CONTROL"]); 180 181 loop = new Handler("ArmDrive"); 182 loop.add(handleDriveArmed); 183 loop.run(); 178 179 include("scripts/handleDriveArmed.js"); 180 181 checkSend(["DRIVE_CONTROL"]); 182 183 loop = new Handler("ArmDrive"); 184 loop.add(handleDriveArmed); 185 loop.run(); 184 186 185 187 … … 195 197 // 2) The feedback is stopped 196 198 // 3) The voltage is off 197 198 // Check age of calibration 199 var service_calibration = new Subscription("FEEDBACK/CALIBRATION"); 200 201 var data_calibration = service_calibration.get(-5000); 202 //if (!data_calibration) 203 // throw new Error("Could not connect to FEEDBACK/CALIBRATION"); 204 205 function makeCurrentCalibration( reason_string ) 206 { 207 console.out( reason_string ); 208 199 function makeCurrentCalibration() 200 { 209 201 dim.send("BIAS_CONTROL/SET_GLOBAL_DAC", 1); 210 202 dim.wait("BIAS_CONTROL", "VoltageOn", 3000); 211 203 212 204 var now = new Date(); 213 205 dim.send("FEEDBACK/CALIBRATE_CURRENTS"); … … 227 219 } 228 220 229 if (!data_calibration) 230 { 231 // FEEDBACK might just be freshly started and 232 // will not yet serve this service. 233 var reason_msg = "No current calibration avaliable. New calibration needed."; 234 makeCurrentCalibration( reason_msg ); 235 } 236 else 237 { 238 var age = data_calibration.time; 239 var now = new Date(); 240 241 //service_calibration.close(); 242 243 var diff = (now-age)/3600000; 244 245 if ((diff>8 && now.getHours()>16)/* || empty*/) 246 { 247 var reason_msg = "Last BIAS crate calibration taken at "+age.toUTCString()+": New calibration needed."; 248 makeCurrentCalibration( reason_msg ); 249 } 250 } 251 252 253 221 // Check age of calibration 222 var service_calibration = new Subscription("FEEDBACK/CALIBRATION"); 223 224 var data_calibration = service_calibration.get(3000, false); 225 226 var age = data_calibration.time; 227 var now = new Date(); 228 229 var diff = (now-age)/3600000; 230 231 // !data_calibration.data: FEEDBACK might just be freshly 232 // started and will not yet serve this service. 233 if (data_calibration.data==null || (diff>8 && now.getHours()>16)) 234 { 235 if (data_calibration.data==null) 236 console.out("No BIAS crate calibration avaliable: New calibration needed."); 237 else 238 console.out("Last BIAS crate calibration taken at "+age.toUTCString()+": New calibration needed."); 239 240 makeCurrentCalibration(); 241 } 242 243 service_calibration.close(); 254 244 255 245 // ================================================================
Note:
See TracChangeset
for help on using the changeset viewer.