Changeset 17324


Ignore:
Timestamp:
11/19/13 18:45:35 (11 years ago)
Author:
tbretz
Message:
Changed file format to zFits; do not require all pixels to be at the correct voltage - this just takes unnecessarily long; stop trigger before switching voltage off or on to avoid a smartfact warning; allow to set the overvoltage; before moving ramp down the voltage to Uov=0; added single-pe run to shutdown; added task 'OVTEST'
File:
1 edited

Legend:

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

    r17190 r17324  
    115115    }
    116116
    117     dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2);
     117    dim.send("FAD_CONTROL/SET_FILE_FORMAT", 6);
    118118
    119119    while (!irq && !takeRun("drs-pedestal", 1000));     // 40 / 20s     (50Hz)
     
    127127    }
    128128
    129     dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2);
     129    dim.send("FAD_CONTROL/SET_FILE_FORMAT", 6);
    130130
    131131    while (!irq && !takeRun("pedestal",     1000));     // 40 / 10s     (80Hz)
     
    222222
    223223
    224     this.ok = cnt==0;// || (this.last!=undefined && Math.abs(this.last-avg)<0.002);
    225 
    226     console.out("  DeltaUov=%.3f (%.3f) [N(>0.033V)=%d]".$(avg, Math.abs(this.last-avg), cnt));
     224    this.ok = cnt<3;// || (this.last!=undefined && Math.abs(this.last-avg)<0.002);
     225
     226    console.out("  DeltaUov=%.3f (%.3f) [N(>0.033V)=%d]".$(avg, avg-this.last, cnt));
    227227
    228228    this.last = avg;
     
    244244    {
    245245        dim.log("Switching voltage off.");
     246
     247        if (dim.state("FTM_CONTROL").name=="TriggerOn")
     248        {
     249            dim.send("FTM_CONTROL/STOP_TRIGGER");
     250            dim.wait("FTM_CONTROL", "Valid", 3000);
     251        }
    246252
    247253        // Supress the possibility that the bias control is
     
    250256        dim.send("FEEDBACK/STOP");
    251257        dim.wait("FEEDBACK", "Calibrated", 3000);
     258
     259        // Make sure we are not in Ramping anymore
     260        dim.wait("BIAS_CONTROL", "VoltageOn", 3000);
    252261
    253262        // Switch voltage off
     
    285294//      For convenience.
    286295
    287 service_feedback.voltageOn = function()
    288 {
    289     //if (Sun.horizon("FACT").isUp)
    290     //    throw new Error("Sun is above FACT-horizon, voltage cannot be switched on.");
    291 
    292     var isOff = dim.state("BIAS_CONTROL").name=="VoltageOff";
     296service_feedback.voltageOn = function(ov)
     297{
     298    if (isNaN(ov))
     299        ov = 1.1;
     300
     301    if (this.ov!=ov && dim.state("FEEDBACK").name=="InProgress")
     302    {
     303        dim.log("Stoping feedback.");
     304        if (dim.state("FTM_CONTROL").name=="TriggerOn")
     305        {
     306            dim.send("FTM_CONTROL/STOP_TRIGGER");
     307            dim.wait("FTM_CONTROL", "Valid", 3000);
     308        }
     309
     310        dim.send("FEEDBACK/STOP");
     311        dim.wait("FEEDBACK", "Calibrated", 3000);
     312
     313        // Make sure we are not in Ramping anymore
     314        dim.wait("BIAS_CONTROL", "VoltageOn", 3000);
     315    }
     316
     317    var isOff = dim.state("FEEDBACK").name=="Calibrated";
    293318    if (isOff)
    294319    {
    295         dim.log("Switching voltage on.");
    296 
    297         dim.send("FEEDBACK/START", 1.1);
     320        dim.log("Switching voltage to Uov="+ov+"V.");
     321
     322        dim.send("FEEDBACK/START", ov);
    298323        dim.wait("FEEDBACK", "InProgress", 45000);
     324
     325        this.ov = ov;
    299326    }
    300327
    301328    // Wait until voltage on
    302329    dim.wait("BIAS_CONTROL", "VoltageOn", 60000); // FIXME: 30000?
    303 
    304 //    if (isOff)
    305 //        this.ok = false;
    306330}
    307331
     
    340364    var now1 = new Date();
    341365
    342     service_feedback.voltageOff();
    343     CloseLid();
     366    var bias = dim.state("BIAS_CONTROL").name;
     367    if (bias=="VoltageOn" || bias=="Ramping")
     368        service_feedback.voltageOn(0);
     369
     370    CloseLid();
    344371
    345372    var now2 = new Date();
     
    369396
    370397    v8.timeout(150000, func);
     398
     399    /*
     400    // Check if DRS calibration is necessary
     401    var diff = getTimeSinceLastDrsCalib();
     402    if (diff>30 || diff==null)
     403    {
     404        doDrsCalibration("singlepe");  // will turn voltage off
     405        if (irq)
     406            break;
     407    }*/
     408
     409    dim.log("Taking single-pe run.");
     410
     411    // The voltage must be on
     412    service_feedback.voltageOn();
     413    service_feedback.waitForVoltageOn();
     414
     415    // Before we can switch to 3000 we have to make the right DRS calibration
     416    dim.log("Taking single p.e. run.");
     417    while (!irq && !takeRun("single-pe", 10000));
     418
     419    // It is unclear what comes next, so we better switch off the voltage
     420    service_feedback.voltageOff();
     421
     422    dim.log("Finishing shutdown.");
    371423
    372424    var now3 = new Date();
     
    600652// Make sure we will write files
    601653// ----------------------------------------------------------------
    602 dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2);
     654dim.send("FAD_CONTROL/SET_FILE_FORMAT", 6);
    603655
    604656// ----------------------------------------------------------------
     
    856908        break;
    857909
     910    case "OVTEST":
     911        dim.send("DRIVE_CONTROL/PARK");
     912        dim.send("FEEDBACK/STOP");
     913
     914        // The lid must be closes
     915        CloseLid();
     916
     917        console.out("Waiting for telescope to park. This may take a while.");
     918        dim.wait("DRIVE_CONTROL", "Locked", 3000);
     919
     920        // Check if DRS calibration is necessary
     921        var diff = getTimeSinceLastDrsCalib();
     922        if (diff>30 || diff==null)
     923        {
     924            doDrsCalibration("ovtest");  // will turn voltage off
     925            if (irq)
     926                break;
     927        }
     928
     929        // The voltage must be on
     930        service_feedback.voltageOn(0.4);
     931        service_feedback.waitForVoltageOn();
     932
     933        dim.log("Taking single p.e. run (0.4V)");
     934        while (!irq && !takeRun("single-pe", 10000));
     935
     936        for (var i=5; i<18; i++)
     937        {
     938            dim.send("FEEDBACK/STOP");
     939            dim.wait("FEEDBACK", "Calibrated", 3000);
     940            dim.wait("BIAS_CONTROL", "VoltageOn", 3000);
     941            dim.send("FEEDBACK/START", i*0.1);
     942            dim.wait("FEEDBACK", "InProgress", 45000);
     943            dim.wait("BIAS_CONTROL", "VoltageOn", 60000); // FIXME: 30000?
     944            service_feedback.waitForVoltageOn();
     945            dim.log("Taking single p.e. run ("+(i*0.1)+"V)");
     946            while (!irq && !takeRun("single-pe", 10000));
     947        }
     948
     949        // It is unclear what comes next, so we better switch off the voltage
     950        service_feedback.voltageOff();
     951        dim.log("Task finished [OVTEST]");
     952        console.out("");
     953        break;
     954
    858955    case "RATESCAN":
    859956        var tm1 = new Date();
     
    867964        OpenLid();
    868965
    869         // The voltage must be switched on
    870         service_feedback.voltageOn();
     966        // Switch the voltage to a reduced level (Ubd)
     967        service_feedback.voltageOn(0);
    871968
    872969        if (obs.source != undefined)
     
    883980        dim.wait("DRIVE_CONTROL", "OnTrack", 150000); // 110s for turning and 30s for stabilizing
    884981
     982        // Now tracking stable, switch voltage to nominal level and wait
     983        // for stability.
     984        service_feedback.voltageOn();
    885985        service_feedback.waitForVoltageOn();
    886986
     
    9011001        // after the Ratescan, no data is written to disk. I don't know why, but it happens all the time
    9021002        // So I decided to put this line here as a kind of patchwork....
    903         //dim.send("FAD_CONTROL/SET_FILE_FORMAT", 2);
     1003        //dim.send("FAD_CONTROL/SET_FILE_FORMAT", 6);
    9041004
    9051005        dim.log("Ratescan done [%.1fs, %.1fs]".$((tm2-tm1)/1000, (new Date()-tm2)/1000));
     
    9461046        if (point)
    9471047        {
     1048            // Switch the voltage to a reduced voltage level
     1049            service_feedback.voltageOn(0);
     1050
    9481051            // Change wobble position every four runs,
    9491052            // start with alternating wobble positions each day
     
    9831086        OpenLid();
    9841087
    985 
    986         // voltage must be switched on after the lid is open for the
    987         // feedback to adapt the voltage properly to the night-sky
    988         // background light level.
    989         service_feedback.voltageOn();
    990 
    9911088        // This is now th right time to wait for th drive to be stable
    9921089        dim.wait("DRIVE_CONTROL", "OnTrack", 150000); // 110s for turning and 30s for stabilizing
    9931090
    994         // Now we have to be prepared for data-taking:
    995         // make sure voltage is on
     1091        // Now we are 'OnTrack', so we can ramp to nominal voltage
     1092        // and wait for the feedback to get stable
     1093        service_feedback.voltageOn();
    9961094        service_feedback.waitForVoltageOn();
    9971095
Note: See TracChangeset for help on using the changeset viewer.