Changeset 18441


Ignore:
Timestamp:
02/17/16 12:10:43 (9 years ago)
Author:
tbretz
Message:
Remove sources with less than 5min. Remove sleep at the beginning and end of the schedule. Add more help text to explain how the program works.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/makeschedule.cc

    r18440 r18441  
    5252#ifdef HAVE_ROOT
    5353    cout <<
     54        "First for each minute of the night a list is calculated of all "
     55        "selected sources fullfiling all global and all source specific "
     56        " constraints, e.g. on the zenith distance or the current.\n"
     57        "\n"
     58        "The remaining source list is sorted by the relative threshold, "
     59        "while the threshold is weighted with a user defined source "
     60        "specific panelty. The first source of the list is taken to "
     61        "be observed.\n"
     62        "\n"
     63        "In a next step the first and last source of the resulting schedule "
     64        "are evaluated. If their observation time is below 40', it is tried "
     65        "to extend it to 40min. If this violates one of the criteria mentioned "
     66        "above or gives an observation time for the neighboring source of "
     67        "less than 40min, try to replace it by the neighboring source. "
     68        "If this also does not fulfull the requirements, the original "
     69        "schedule remains unchanged.\n"
     70        "\n"
     71        "Now a similar check is run for all intermediate sources. They are "
     72        "checked (from the beginning to the end, one by one), if they have "
     73        "an observation time of less than 40min. In this case, it is tried "
     74        "to remove them. The observation of the two neighboring sources is "
     75        "extended to their penelized point of equal relative threshold. "
     76        "If this solution would not fullfil all criteria, no change is made.\n"
     77        "\n"
     78        "In a last step, all remaining sources with less than 5min "
     79        "observation time are replaced with sleep and sleep after startup "
     80        "or before shutdown are removed.\n"
     81        "\n"
    5482        "\n"
    5583        "Examples:\n"
     
    409437}
    410438
     439void RemoveMiniSources(vector<Source> &obs)
     440{
     441    for (size_t i=1; i<obs.size()-1; i++)
     442    {
     443        if (obs[i].duration()>=5./24/60)
     444            continue;
     445
     446        if (obs[i-1].name=="SLEEP" && obs[i+1].name=="SLEEP")
     447            continue;
     448
     449        cout << "Mini source [" << obs[i].name << "] detected < 5min... replaced by sleep." << endl;
     450
     451        if (obs[i-1].name=="SLEEP" && obs[i+1].name=="SLEEP")
     452        {
     453            obs[i-1].end = obs[i+2].begin;
     454
     455            obs.erase(obs.begin()+i+1);
     456            obs.erase(obs.begin()+i);
     457
     458            i -= 2;
     459
     460            cout << "Combined two surrounding sleep into one" << endl;
     461
     462            continue;
     463        }
     464
     465        if (obs[i-1].name=="SLEEP")
     466        {
     467            obs[i-1].end = obs[i+1].begin;
     468            obs.erase(obs.begin()+i);
     469            i--;
     470
     471            cout << "Extended previous sleep" << endl;
     472
     473            continue;
     474        }
     475
     476        if (obs[i+1].name=="SLEEP")
     477        {
     478            obs[i+1].begin = obs[i-1].end;
     479            obs.erase(obs.begin()+i);
     480
     481            cout << "Extended following sleep" << endl;
     482
     483            i--;
     484            continue;
     485        }
     486    }
     487}
     488
     489void CheckStartupAndShutdown(vector<Source> &obs)
     490{
     491    if (obs.front().name=="SLEEP")
     492    {
     493        obs.erase(obs.begin());
     494        cout << "Detected sleep after startup... removed." << endl;
     495    }
     496
     497    if (obs.back().name=="SLEEP")
     498    {
     499        obs.pop_back();
     500        cout << "Detected sleep before shutdown... removed." << endl;
     501    }
     502}
     503
    411504void Print(const vector<Source> &obs, double startup_offset)
    412505{
     
    665758    while (RescheduleIntermediateSources(obs));
    666759
     760    RemoveMiniSources(obs);
     761    CheckStartupAndShutdown(obs);
     762
    667763    // ---------------------------------------------------------------------
    668764
Note: See TracChangeset for help on using the changeset viewer.