Changeset 15454


Ignore:
Timestamp:
04/28/13 11:30:11 (12 years ago)
Author:
tbretz
Message:
Fixed a crash in the startup information print in case there is no schedule at all; removed FAD_CONTROL/STATISTICS2; limit maximum number of re-configure to 3
File:
1 edited

Legend:

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

    r15411 r15454  
    137137}
    138138
     139
     140// ================================================================
     141//  Code related to taking data
     142// ================================================================
     143
    139144var sub_connections = new Subscription("FAD_CONTROL/CONNECTIONS");
    140145
    141 /**
    142  * call-back function of FAD_CONTROL/CONNECTIONS
    143  * store IDs of problematic FADs
    144  *
    145  */
    146 /*
    147 sub_connections.onchange = function(evt)
    148 {
    149     // This happens, but why?
    150     if (!evt.obj['status'])
    151         return;
    152 
    153     this.reset = [ ];
    154 
    155     for (var x=0; x<40; x++)
    156         if (evt.obj['status'][x]!=66 && evt.obj['status'][x]!=67)
    157             this.reset.push(x);
    158 
    159     if (this.reset.length==0)
    160         return;
    161 
    162     //m.alarm("FAD board loss detected...");
    163     dim.send("MCP/RESET");
    164     dim.send("FAD_CONTROL/CLOSE_OPEN_FILES");
    165 }
    166 */
     146var startrun = new Subscription("FAD_CONTROL/START_RUN");
     147startrun.get(5000);
    167148
    168149/**
     
    184165 *          exit();
    185166 */
    186 sub_connections.reconnect = function()
    187 {
    188     // this.reset is a list containing the IDs of FADs,
    189     // which have neither CONNECTION==66 nor ==67, whatever this means :-)
    190     if (this.reset.length==0)
    191         return true;
    192 
    193     console.out("  Reconnect: start ["+this.reset.length+"]");
    194 
    195     for (var i=0; i<this.reset.length; i++)
    196         dim.send("FAD_CONTROL/DISCONNECT", this.reset[i]);
    197 
    198     v8.sleep(3000);
    199 
    200     while (this.reset.length)
    201         dim.send("FAD_CONTROL/CONNECT", this.reset.pop());
    202 
    203     v8.sleep(1000);
    204     dim.wait("FAD_CONTROL", "Connected", 3000);
    205 
    206     console.out("  Reconnect: end");
    207 
    208     return true;
    209 }
    210 
    211 // ================================================================
    212 //  Code related to taking data
    213 // ================================================================
    214 
    215 var startrun = new Subscription("FAD_CONTROL/START_RUN");
    216 startrun.get(5000);
    217 
    218167function reconnect(list, txt)
    219168{ /*
     
    264213    var nextrun = startrun.get().obj['next'];
    265214    console.out("  Take run %3d".$(nextrun)+": N="+count+" T="+time+"s ["+type+"]");
    266 
    267     incomplete = 0;
    268 
    269     dim.send("MCP/START", time?time:-1, count?count:-1, type);
    270215
    271216    // FIXME: Replace by callback?
     
    308253    // Here we could check and handle fad losses
    309254
     255    incomplete = 0;
     256
    310257    for (var n=0; n<3; n++)
    311258    {
     259        dim.send("MCP/START", time?time:-1, count?count:-1, type);
    312260        try
    313261        {
    314262            dim.wait("MCP", "TakingData", 15000);
     263break;
    315264        }
    316265        catch (e)
     
    346295            reconnect(list, "configuration");
    347296
    348             if (n<2)
     297            /*if (n<2)
    349298                return false;
    350299
    351             throw e;
     300                throw e;
     301                */
     302
     303            if (n==2)
     304                throw e;
    352305        }
    353306    }
     
    879832{
    880833    var n = new Date();
    881     if (test==-1)
     834    if (observations.length>0 && test==-1)
    882835        console.out(n.toUTCString()+": First observation scheduled for "+observations[0].start.toUTCString());
    883836    if (test>=0 && test<observations.length)
    884837        console.out(n.toUTCString()+": First observation should start immediately.");
    885     if (observations[0].start>n+12*3600*1000)
     838    if (observations.length>0 && observations[0].start>n+12*3600*1000)
    886839        console.out(n.toUTCString()+": No observations scheduled for the next 12 hours!");
     840    if (observations.length==0)
     841        console.out(n.toUTCString()+": No observations scheduled!");
    887842}
    888843
Note: See TracChangeset for help on using the changeset viewer.