Changeset 15362 for trunk/FACT++/scripts


Ignore:
Timestamp:
04/18/13 10:20:09 (12 years ago)
Author:
tbretz
Message:
Set the sunhorizon to -12deg; implemented automatic reconnect; disconnect bias at shutdown; allow drive to be on during day time observations - hopefully all other checks work properly.
File:
1 edited

Legend:

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

    r15354 r15362  
    133133    incomplete = inc;
    134134
    135     console.out("Sending MCP/STOP");
     135    console.out("", "Incomplete event detected, sending MCP/STOP");
    136136    dim.send("MCP/STOP");
    137137}
     
    241241    }
    242242
    243     console.out("   ...waiting for 5s");
    244     v8.sleep(5000);
     243    console.out("   ...waiting for 3s");
     244    v8.sleep(3000);
    245245
    246246    for (var i=0; i<list.length; i++)
     
    266266
    267267    incomplete = 0;
     268
    268269    dim.send("MCP/START", time?time:-1, count?count:-1, type);
    269270
     
    337338
    338339        /*** FOR REMOVE ***/
     340        /*
    339341        var reset = [ ];
    340342
     
    353355            console.out("  FADs belong to crate(s): "+reset);
    354356            console.out("");
    355         }
     357        }*/
    356358        /**** FOR REMOVE ****/
    357359
     
    363365        reconnect(list, "configuration");
    364366
    365         throw e;
     367        return false;
    366368    }
    367369
     
    370372    if (incomplete)
    371373    {
    372         console.out("Incomplete: "+incomplete);
    373 
    374374        console.out("");
    375375        console.out("MCP:         "+dim.state("MCP").name);
    376376        console.out("FAD_CONTROL: "+dim.state("FAD_CONTROL").name);
    377377        console.out("FTM_CONTROL: "+dim.state("FTM_CONTROL").name);
    378         console.out("");
    379378
    380379        dim.wait("MCP",         "Idle", 3000);
     
    392391        reconnect(list, "data taking");
    393392
    394         throw new Error("In-run FAD loss detected.");
     393        return false;
     394
     395        //throw new Error("In-run FAD loss detected.");
    395396    }
    396397
     
    421422            continue;
    422423
    423         // Does that fix the runopen before runclose problem?
    424         //dim.wait("FAD_CONTROL", "Connected", 3000);
    425         //v8.sleep(1000);
    426 
    427424        if (!takeRun("drs-gain",     1000))     // 40 / 20s     (50Hz)
    428425            continue;
    429426
    430         // Does that fix the runopen before runclose problem?
    431         //dim.wait("FAD_CONTROL", "Connected", 3000);
    432         //v8.sleep(1000);
    433 
    434427        if (!takeRun("drs-pedestal", 1000))     // 40 / 20s     (50Hz)
    435428            continue;
    436429
    437         dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2);
    438         if (!takeRun("drs-pedestal", 1000))     // 40 / 20s     (50Hz)
    439             continue;
    440         if (!takeRun("drs-time",     1000))     // 40 / 20s     (50Hz)
    441             continue;
    442 
     430        break;
     431    }
     432
     433    dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2);
     434
     435    while (!takeRun("drs-pedestal", 1000));     // 40 / 20s     (50Hz)
     436    while (!takeRun("drs-time",     1000));     // 40 / 20s     (50Hz)
     437
     438    while (1)
     439    {
    443440        dim.send("FAD_CONTROL/RESET_SECONDARY_DRS_BASELINE");
    444         if (!takeRun("pedestal",     1000))     // 40 / 10s     (80Hz)
    445             continue;
    446 
    447         dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2);
    448         if (!takeRun("pedestal",     1000))     // 40 / 10s     (80Hz)
    449             continue;
     441        if (takeRun("pedestal",     1000))      // 40 / 10s     (80Hz)
     442            break;
     443    }
     444
     445    dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2);
     446
     447    while (!takeRun("pedestal",     1000));     // 40 / 10s     (80Hz)
     448
    450449        //                                       -----------
    451450        //                                       4'40 / 2'00
    452 
    453         break;
    454     }
    455451
    456452    console.out("  DRS calibration done [%.1f]".$((new Date()-tm)/1000));
     
    712708    dim.send("FEEDBACK/ENABLE_OUTPUT", false);
    713709    dim.send("FTM_CONTROL/STOP_TRIGGER");
    714 
    715     dim.wait("FEEDBACK", "CurrentCtrlIdle", 3000);
    716     dim.wait("FTM_CONTROL", "Idle", 3000);
     710    dim.send("BIAS_CONTROL/DISCONNECT");
     711
     712    dim.wait("FEEDBACK",     "CurrentCtrlIdle",  3000);
     713    dim.wait("FTM_CONTROL",  "Idle",             3000);
     714    dim.wait("BIAS_CONTROL", "Disconnected",     3000);
    717715
    718716    var report = sub.get();
     
    911909var sub;
    912910var lastId;
    913 var sun = Sun.horizon(-13);
     911var sun = Sun.horizon(-12);
    914912var system_on;  // undefined
    915913
     
    933931    // Check if we have to take action do to sun-rise
    934932    var was_up = sun.isUp;
    935     sun = Sun.horizon(-13);
     933    sun = Sun.horizon(-12);
    936934    if (!was_up && sun.isUp)
    937935    {
     
    10061004    console.out("\n"+(new Date()).toUTCString()+": Current measurement: "+obs[sub]);
    10071005
    1008     var power_states = sun.isUp || system_on===false ? [ "DriveOff" ] : [ "SystemOn" ];
     1006    // FIXME: Maybe print a warning if Drive is on during day time!
     1007
     1008    // It is not ideal that we allow the drive to be on during day time, but
     1009    // otherwise it is difficult to allow e.g. the STARTUP at the beginning of the night
     1010    var power_states = sun.isUp || system_on===false ? [ "DriveOff", "SystemOn" ] : [ "SystemOn" ];
    10091011    var drive_states = sun.isUp || system_on===false ?   undefined    : [ "Armed", "Tracking", "OnTrack" ];
    10101012
     
    10391041    if (!checkStates(table))
    10401042    {
    1041         throw new Error("Something unexpected has happened. One of the servers"+
     1043        throw new Error("Something unexpected has happened. One of the servers "+
    10421044                        "is in a state in which it should not be. Please,"+
    10431045                        "try to find out what happened...");
Note: See TracChangeset for help on using the changeset viewer.