Changeset 15136 for trunk/FACT++/scripts


Ignore:
Timestamp:
03/22/13 17:12:31 (12 years ago)
Author:
tbretz
Message:
Removed some obsolete check; close open files if any to avoid late arrival of events from previous runs as much as possible; for the same reason wait a second; fixed a bug in the event and drs_counter - both never really accessed the counter.
File:
1 edited

Legend:

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

    r15116 r15136  
    5858
    5959var runs = service_drs.get(5000, false);
    60 if (!runs)
    61     throw new Error("Could not connect to FAD_CONTROL/DRS_RUNS");
     60//if (!runs)
     61//    throw new Error("Could not connect to FAD_CONTROL/DRS_RUNS");
    6262
    6363var power = dim.state("AGILENT_CONTROL").time;
     
    9090    // events. Thus there is no real guarantee that we do not receive
    9191    // data of the previous run after we have started a new one.
    92     dim.wait("FAD_CONTROL", "Connected", 10000);
     92    if (dim.state("FAD_CONTROL").name=="WritingData")
     93    {
     94        dim.send("FAD_CONTROL/CLOSE_OPEN_FILES");
     95        dim.wait("FAD_CONTROL", "Connected", 3000);
     96    }
    9397    v8.sleep(1000); // Let 'timeout' in SendRawData pass
    9498
    95     var event = service_event.get(5000, false);
    96     var event_counter = event.counter;
     99    var event_counter = service_event.get(5000, false).counter;
    97100
    98101    console.out("Starting drs-gain");
     
    102105
    103106    var d = new Date();
    104     v8.timeout(10000, function() { if (service_event.get(0, false).counter>event_counter) return true; });
    105     //while (service_event.get(0, false).counter<=event_counter)
    106     //    v8.sleep();
     107    //v8.timeout(10000, function() { if (service_event.get(0, false).counter>event_counter) return true; });
     108    while (service_event.get(0, false).counter<=event_counter)
     109        v8.sleep();
    107110
    108111    console.out("Event received: "+(new Date()-d)+"ms");
     
    110113    dim.send("MCP/STOP");
    111114
    112     event = service_event.get(0, false);
     115    var event = service_event.get(0, false);
    113116    service_event.close();
    114117
     
    131134
    132135        // FIXME: Timeout
    133         var drs_counter = service_drs.get(0, false);
     136        var drs_counter = service_drs.get(0, false).counter;
    134137        dim.send("FAD_CONTROL/LOAD_DRS_CALIBRATION", filefmt.$(yy, mm, dd, yy, mm, dd, nn));
     138        //v8.timeout(5000, function() { if (service_drs.get(0, false).counter>drs_counter) return true; });
    135139        while (drs_counter == service_drs.get(0, false).counter)
    136140            v8.sleep();
Note: See TracChangeset for help on using the changeset viewer.