Changeset 15094 for trunk/FACT++


Ignore:
Timestamp:
03/18/13 14:42:46 (12 years ago)
Author:
tbretz
Message:
Tries to improve a problem which cantake place when the script is re-started before the previous run is properly closed; improved output.
File:
1 edited

Legend:

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

    r15071 r15094  
    7979    //console.out("Most probablay the camera has not been checked for underflows yet.");
    8080
     81    dim.send("FAD_CONTROL/START_DRS_CALIBRATION");
     82    dim.send("FAD_CONTROL/SET_FILE_FORMAT", 0);
     83
    8184    var service_event = new Subscription("FAD_CONTROL/EVENT_DATA");
    8285    var event = service_event.get(5000, false);
    8386
     87    // This needs a better solution! The problem is that the
     88    // event builder might still be writing a file (WritingData),
     89    // but even if the file is closed (CLOSE_OPEN_FILES) the
     90    // thread sending data (EVENT_DATA) might still be processing
     91    // events. Thus there is no real guarantee that we do not receive
     92    // data of the previous run after we have started a new one.
     93    dim.wait("Connected", 10000);
     94    v8.sleep(1000); // Let 'timeout' in SendRawData pass
     95
    8496    var event_counter = event.counter;
    8597
    86     dim.send("FAD_CONTROL/START_DRS_CALIBRATION");
    87     dim.send("FAD_CONTROL/SET_FILE_FORMAT", 0);
     98    console.out("Starting drs-gain");
     99    dim.send("MCP/START", -1, 5, "drs-gain");
    88100
    89     console.out("Starting drs-gain");
    90     dim.send("MCP/START", -1, 3, "drs-gain");
     101    console.out("Waiting for new event");
    91102
    92     // FIXME: add a timeout here (10s)
    93     console.out("Waiting for new event");
    94103    var d = new Date();
    95     while (event_counter == service_event.get(0, false).counter)
    96         v8.sleep();
     104    v8.timeout(10000, function() { if (service_event.get(0, false).counter>event_counter) return true; });
    97105
    98106    console.out("Event received: "+(new Date()-d)+"ms");
     
    163171    {
    164172        if (stat0.count>8)
    165             throw new Error("Underflow condition detected in about "+stat0.count/9+" DRS.");
     173            throw new Error("Underflow condition detected in about "+parseInt(stat0.count/9+.5)+" DRS.");
    166174
    167175        log.warn("There is probably an underflow condition in one DRS... please check manually.");
Note: See TracChangeset for help on using the changeset viewer.