Changeset 16050 for trunk/FACT++/scripts


Ignore:
Timestamp:
05/22/13 22:37:44 (11 years ago)
Author:
tbretz
Message:
Make use of takeRun.js to 'fix' FAD problems also during the test run to check for underflows.
File:
1 edited

Legend:

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

    r15161 r16050  
    9797    v8.sleep(1000); // Let 'timeout' in SendRawData pass
    9898
    99     var event_counter = service_event.get(10000, false).counter;
    100 
    101     console.out("Starting drs-gain");
    102     dim.send("MCP/START", 15, -1, "drs-gain");
    103 
    104     console.out("Waiting for new event");
    105 
    106     var d = new Date();
    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();
    110 
    111     console.out("Event received: "+(new Date()-d)+"ms");
    112 
    113     dim.send("MCP/STOP");
     99    console.out("Starting drs-gain... waiting for new event");
     100
     101    var sub_incomplete = new Subscription("FAD_CONTROL/INCOMPLETE");
     102    var sub_connections = new Subscription("FAD_CONTROL/CONNECTIONS");
     103    var sub_startrun = new Subscription("FAD_CONTROL/START_RUN");
     104    sub_startrun.get(5000);
     105    sub_connections.get(5000);
     106    sub_startrun.get(5000);
     107
     108    include('scripts/takeRun.js');
     109
     110    while (1)
     111    {
     112        var event_counter = service_event.get(10000, false).counter;
     113
     114        var stop = function ()
     115        {
     116            while (1)
     117            {
     118                if (dim.state("MCP").name=="TakingData" && service_event.get(0, false).counter>event_counter)
     119                {
     120                    dim.send("MCP/STOP");
     121                    return;
     122                }
     123                v8.sleep(100);
     124            }
     125        }
     126
     127        var thread = new Thread(250, stop);
     128
     129        var rc = takeRun("drs-gain");
     130
     131        thread.kill();
     132
     133        if (rc)
     134            break;
     135    }
     136
     137    console.out("Event received.");
     138
     139    sub_incomplete.close();
     140    sub_connections.close();
     141    sub_startrun.close();
     142
     143
     144    // FIXME: Restore DRS calibration in case of failure!!
     145    //        FAD Re-connect in case of failure?
     146    //        MCP/RESET in case of failure?
     147    //        Proper error reporting!
    114148
    115149    var event = service_event.get(0, false);
     
    139173        var now = new Date();
    140174        v8.timeout(3000, function() { if (service_drs.get(0, false).counter>drs_counter) return true; });
    141         //while (drs_counter == service_drs.get(0, false).counter)
    142         //    v8.sleep();
     175
    143176        console.out("Last DRS calibration restored ["+(new Date()-now)/1000+"s]");
    144177    }
Note: See TracChangeset for help on using the changeset viewer.