Changeset 17174 for trunk/FACT++/scripts


Ignore:
Timestamp:
09/19/13 16:15:12 (11 years ago)
Author:
tbretz
Message:
Some minor updates and a bug fix in the format of the NOMINAL service.
Location:
trunk/FACT++/scripts
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/scripts/Main.js

    r17031 r17174  
    221221        return;
    222222
    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?
     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
    234231service_feedback.voltageOff = function()
    235232{
     
    247244    {
    248245        dim.log("Switching voltage off.");
    249 
    250         this.ok = undefined;
    251246
    252247        // Supress the possibility that the bias control is
     
    260255    }
    261256
    262     dim.wait("BIAS_CONTROL", "VoltageOff", 60000);
     257    dim.wait("BIAS_CONTROL", "VoltageOff", 60000); // FIXME: 30000?
    263258
    264259    // FEEDBACK stays in CurrentCtrl when Voltage is off but output enabled
     
    305300
    306301    // Wait until voltage on
    307     dim.wait("BIAS_CONTROL", "VoltageOn", 60000);
    308 
    309     if (isOff)
    310         this.ok = false;
     302    dim.wait("BIAS_CONTROL", "VoltageOn", 60000); // FIXME: 30000?
     303
     304//    if (isOff)
     305//        this.ok = false;
    311306}
    312307
     
    324319    var now = new Date();
    325320
    326     v8.timeout(60000, func, this);
     321    this.last = undefined;
     322    this.ok = false;
     323    v8.timeout(4*60000, func, this); // FIMXE: Remove 4!
     324    this.ok = undefined;
    327325
    328326    if (irq)
     
    330328    else
    331329        dim.log("Voltage stable within limits");
    332 
    333     this.ok = undefined;
    334330}
    335331
     
    378374    //dim.send("FEEDBACK/STOP");
    379375    dim.send("FTM_CONTROL/STOP_TRIGGER");
     376
     377    dim.wait("FTM_CONTROL",  "Valid",        3000);
     378    dim.wait("FEEDBACK",     "Calibrated",   3000);
     379
    380380    dim.send("BIAS_CONTROL/DISCONNECT");
    381 
    382     dim.wait("FTM_CONTROL",  "Valid",        3000);
    383381    dim.wait("BIAS_CONTROL", "Disconnected", 3000);
    384     dim.wait("FEEDBACK",     "Calibrated",   3000);
    385382
    386383    var report = sub.get();
     
    806803        while (!irq && !takeRun("single-pe", 10000));
    807804
     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
    808839        // It is unclear what comes next, so we better switch off the voltage
    809840        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
    810855        system_on = true;
    811856        dim.log("Task finished [STARTUP]");
     
    909954        console.out("");
    910955        break; // case "RATESCAN"
    911 
     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*/
    9121115
    9131116    case "DATA":
  • trunk/FACT++/scripts/Observation_class.js

    r16074 r17174  
    5858        case 'DATA':
    5959            if (i!=obj.measurements.length-1)
    60                 throw new Error("DATA must be the last in the list of measurements");
     60                throw new Error("DATA [n="+i+", "+utc.toUTCString()+"] must be the last in the list of measurements [cnt="+obj.measurements.length+"]");
    6161            if (ret[i].source == undefined)
    6262                throw new Error("Observation must have either 'source' or 'task' " +
     
    7979                                "if 'task' == 'ratescan'");
    8080            break;
    81 
     81       /*
     82        case 'FEEDBACK-TEST':
     83            if (ret[i].source == undefined && (ret[i].ra == undefined || ret[i].dec == undefined))
     84                throw new Error("Observation must have either 'source' or 'ra' & 'dec' " +
     85                                "if 'task' == 'ratescan'");
     86            break;
     87        */
     88        //case 'SINGLEPE-TEST':
    8289        case 'SINGLEPE':
    8390        case 'DRSCALIB':
  • trunk/FACT++/scripts/Startup.js

    r17028 r17174  
    218218{
    219219    dim.send("BIAS_CONTROL/SET_ZERO_VOLTAGE");
    220     dim.wait("BIAS_CONTROL", "VoltageOff", 15000);
     220    dim.wait("BIAS_CONTROL", "VoltageOff", 30000); // waS: 15000
    221221
    222222    var now = new Date();
     
    227227
    228228    console.out("Wait for calibration to end");
    229     dim.wait("FEEDBACK", "Calibrated", 60000);
     229    dim.wait("FEEDBACK", "Calibrated", 90000);
    230230
    231231    console.out("Calibration finished ["+(new Date()-now)+"ms]");
    232232
    233233    console.out("Wait for voltage to be off");
    234     dim.wait("BIAS_CONTROL", "VoltageOff", 5000);
     234    dim.wait("BIAS_CONTROL", "VoltageOff", 30000); // was: 15000
    235235}
    236236
     
    261261// ================================================================
    262262
    263 dim.send("BIAS_CONTROL/SET_EXPERT_MODE", true);
     263dim.log("Switching to old bias calibration and feedback.");
     264dim.send("BIAS_CONTROL/EXPERT_MODE", true);
    264265dim.send("BIAS_CONTROL/EXPERT_LOAD_MAP_FILE", "/home/fact/operation/GAPDmap_with_spare_module-new.txt");
    265 dim.send("BIAS_CONTROL/SET_EXPERT_MODE", false);
    266 dim.send("FEEDBACK/ENABLE_OLD_ALGORITHM", false);
     266dim.send("BIAS_CONTROL/EXPERT_MODE", false);
     267dim.send("FEEDBACK/ENABLE_OLD_ALGORITHM", true);
     268dim.send("FEEDBACK/ENABLE_TEMP_OFFSETS", false);
     269v8.sleep(3000);
    267270
    268271// ================================================================
     
    283286 [ "PWR_CONTROL",     [ "SystemOn"                        ] ],
    284287 [ "AGILENT_CONTROL", [ "VoltageOn"                       ] ],
    285  [ "BIAS_CONTROL",    [ "VoltageOn", "VoltageOff"         ] ],
     288 [ "BIAS_CONTROL",    [ "VoltageOff"                      ] ],
    286289 [ "FEEDBACK",        [ "Calibrated"                      ] ],
    287290 [ "RATE_SCAN",       [ "Connected"                       ] ],
  • trunk/FACT++/scripts/getSchedule.js

    r15292 r17174  
    33function getSchedule()
    44{
    5     // List of all available measurement types
    6     var measurementType = [ "STARTUP", "IDLE", "DRSCALIB", "SINGLEPE", "DATA", "RATESCAN", "SHUTDOWN" ];
     5    // List of all available measurement types (see also Observation_class.js)
     6    var measurementType = [ "STARTUP", "IDLE", "DRSCALIB", "SINGLEPE", "DATA", "RATESCAN", "SHUTDOWN"/*, "FEEDBACK-TEST", "SINGLEPE-TEST"*/ ];
    77
    88    // Get current time
Note: See TracChangeset for help on using the changeset viewer.