Changeset 15291


Ignore:
Timestamp:
04/10/13 10:19:30 (12 years ago)
Author:
tbretz
Message:
Read the schedule from the database instead of the file directly. The old version is still available as MainClassic.js
File:
1 edited

Legend:

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

    r15289 r15291  
    1616include('scripts/Observation_class.js');
    1717
     18/*
    1819// this file just contains the definition of
    1920// the variable observations, which builds our nightly schedule, hence the filename
     
    3233    }
    3334}
     35*/
     36
     37include('scripts/ReadSchedule.js');
     38
     39var observations = [ ];
    3440
    3541// Get the observation scheduled for 'now' from the table and
     
    4248    if (isNaN(now.valueOf()))
    4349        throw new Error("Date argument in getObservation invalid.");
     50
     51    observations = getSchedule();
    4452
    4553    for (var i=0; i<observations.length; i++)
     
    350358    dim.wait("MCP", "Idle", time>0 ? time*1250 : undefined); // run time plus 25%
    351359
     360    console.out("debug: "+incomplete);
     361
    352362    if (incomplete)
    353363    {
     
    790800var run = -2; // getObservation never called
    791801var sub;
    792 var lastObs;
     802var lastId;
    793803var sun = Sun.horizon(-13);
    794804var system_on;  // undefined
     
    828838
    829839    // Check if observation target has changed
    830     if (lastObs!=idxObs) // !Object.isEqual(obs, nextObs)
    831     {
    832         console.out("--- "+idxObs+" ---");
     840    if (lastId!=obs.id) // !Object.isEqual(obs, nextObs)
     841    {
     842        console.out("--- "+obs.id+" ---");
    833843        console.out("Current time:        "+new Date().toUTCString());
    834844        console.out("Current observation: "+obs.start.toUTCString());
     
    855865        run = 0;
    856866    }
    857     lastObs = idxObs;
     867    lastId = obs.id;
    858868
    859869    if (nextObs==undefined && obs[obs.length-1].task!="SHUTDOWN")
     
    868878    }
    869879
    870     var task = obs[sub].task;
    871 
    872880    // Check if sun is still up... only DATA and RATESCAN must be suppressed
    873     if ((task=="DATA" || task=="RATESCAN") && sun.isUp)
     881    if ((obs[sub].task=="DATA" || obs[sub].task=="RATESCAN") && sun.isUp)
    874882    {
    875883        var now = new Date();
     
    916924        ];
    917925
     926
    918927    if (!checkStates(table))
    919928    {
Note: See TracChangeset for help on using the changeset viewer.