Changeset 18216


Ignore:
Timestamp:
06/16/15 17:04:04 (9 years ago)
Author:
tbretz
Message:
Changed timeout for bias crate diconnect and toggling drive power to 3s. These commands should immediately respond, so 3s must be enough as it is enough everywhere else. Correct unification of the parking, added PFMINI_CONTROL, make sure the rate reference in case of ratescans is the camera rate.
File:
1 edited

Legend:

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

    r18176 r18216  
    388388    dim.log("Starting shutdown ["+type+"].");
    389389
    390     var shutdown_start_date = new Date();
     390    var now1 = new Date();
    391391
    392392    var bias = dim.state("BIAS_CONTROL").name;
     
    396396    CloseLid();
    397397
    398     var shutdown_after_close_lid_date = new Date();
    399 
     398    var now2 = new Date();
     399
     400    dim.send("DRIVE_CONTROL/PARK");
     401
     402    console.out("","Waiting for telescope to park. This may take a while.");
     403
     404    // FIXME: This might not work is the drive is already close to park position
     405    dim.wait("DRIVE_CONTROL", "Locked", 3000);
     406
     407    //unlock drive if task was sleep
    400408    if (type=="sleep")
    401         dim.send("DRIVE_CONTROL/MOVE_TO", 101, 0);
    402     else
    403         dim.send("DRIVE_CONTROL/PARK");
    404 
    405     console.out("","Waiting for telescope to park. This may take a while.");
    406 
    407     // FIXME: This might not work is the drive is already close to park position
    408     if (type!="sleep")
    409         dim.wait("DRIVE_CONTROL", "Locked", 3000);
     409        dim.send("DRIVE_CONTROL/UNLOCK");
    410410
    411411    var sub = new Subscription("DRIVE_CONTROL/POINTING_POSITION");
     
    459459    dim.log("Finishing shutdown.");
    460460
    461     var shutdown_after_bias_off_data = new Date();
     461    var now3 = new Date();
    462462
    463463    dim.send("FTM_CONTROL/STOP_TRIGGER");
     
    470470    {
    471471        dim.send("BIAS_CONTROL/DISCONNECT");
    472         dim.send("PWR_CONTROL/TOGGLE_DRIVE");
    473         dim.wait("BIAS_CONTROL", "Disconnected", 6000);
    474         dim.wait("PWR_CONTROL", "DriveOff", 6000);
     472
     473        var pwrctrl_state = dim.state("PWR_CONTROL").name;
     474        if (pwrctrl_state=="SystemOn" ||
     475            pwrctrl_state=="BiasOff"  ||
     476            pwrctrl_state=="DriveOn")
     477            dim.send("PWR_CONTROL/TOGGLE_DRIVE");
     478
     479        dim.wait("BIAS_CONTROL", "Disconnected", 3000);
     480        dim.wait("PWR_CONTROL",  "DriveOff",     3000);
    475481    }
    476482
     
    489495    console.out("    FTM_CONTROL:   "+dim.state("FTM_CONTROL").name);
    490496    console.out("    BIAS_CONTROL:  "+dim.state("BIAS_CONTROL").name);
    491     console.out("    PWR_CONTROL:  "+dim.state("PWR_CONTROL").name);
     497    console.out("    PWR_CONTROL:   "+dim.state("PWR_CONTROL").name);
    492498    console.out("");
    493     dim.log("Shutdown: end ["
    494                    + (shutdown_after_close_lid_date-shutdown_start_date)/1000
    495                    + "s, "
    496                    + (shutdown_after_bias_off_data-shutdown_after_close_lid_date)/1000
    497                    + "s, "
    498                    + (new Date()-shutdown_after_bias_off_data)/1000+"s]"
    499            );
     499    dim.log("Shutdown: end ["+(now2-now1)/1000+"s, "+(now3-now2)/1000+"s, "+(new Date()-now3)/1000+"s]");
    500500    console.out("");
    501501
     
    625625         "TNG_WEATHER/DATA",
    626626         "TNG_WEATHER/DUST",
     627         "PFMINI_CONTROL/DATA",
    627628        ];
    628629
     
    961962         [ "GPS_CONTROL",         [ "Locked"  ] ],
    962963         [ "SQM_CONTROL",         [ "Disconnected", "Connected", "Valid" ] ],
     964         [ "PFMINI_CONTROL",      [ "Disconnected", "Connected", "Receiving" ] ],
    963965        ];
    964966
     
    11601162            dim.log("Starting ratescan.");
    11611163
     1164            //set reference to whole camera (in case it was changed)
     1165            dim.send("RATE_SCAN/SET_REFERENCE_CAMERA");
    11621166            // Start rate scan
    11631167            dim.send("RATE_SCAN/START_THRESHOLD_SCAN", 50, 1000, -10, "default");
     
    12471251            dim.log("Starting ratescan 2/1 ["+obs[sub].rstype+"]");
    12481252
     1253            //set reference to whole camera (in case it was changed)
     1254            dim.send("RATE_SCAN/SET_REFERENCE_CAMERA");
    12491255            // Start rate scan
    12501256            dim.send("RATE_SCAN/START_THRESHOLD_SCAN", 50, 300, 20, obs[sub].rstype);
Note: See TracChangeset for help on using the changeset viewer.