DEIMOS
Earth Observation Mission CFI Software
Usage Guide for Object Oriented Software
ESA

VISIBILITY CALCULATION

The Earth Observation CFI Visibility library contains a set of classes and methods to compute the time intervals in which a satellite instrument has visiblity of:

The visibility is computed for an orbit interval requested by the user.

The following list details the possibilities to follow for computing the visibility segments:

  1. For Earth Zones (one or more):

    • Initialise the Swath and SwathId objects
    • Initialize an object of type AttitudeDef if you want to use an attitude different from the one defined in the swath definition
    • Create an object of type ZoneInfoList with the zone or zones. Note: it can be used a zone file or ZoneRec objects.
    • Get the visibility for a zone defined in a file with Swath::zoneVisTimeCompute

  2. For Ground Stations (one or more):

    • Initialise the Swath and SwathId objects
    • Initialize an object of type AttitudeDef if you want to use an attitude different from the one defined in the swath definition
    • Create an object of type StationInfoList with the zone or zones. Note: it can be used a zone file or StationRec objects.
    • Get the visibility for a zone defined in a file with Swath::stationVisTimeCompute

  3. For Starcrafts:

    • For source and target satellites, you must initialize OrbitId with the orbital information and the attitude frames objects (SatNomTransId, SatTransId and InstrTransId)
    • Initialize an object of type LinkData with the source satellite masks and minimum link altitude
    • Get the visibility for the Starcraft with the method scVisTime.

  4. Star Visibility:

    • Construct an object of the SwathStar class defined in the CFI Visibility library. The object can be created with the empty constructor and then call the set method or it can be directly created using the constructor with the parameters. The SwathStar needs as inputs the OrbitId and the upper and the lower swath file names.

    • Get the visibility with one of the method starVisTime. One method takes the star from the input star database file and the star name. The second method takes the star data directly from the input parameters.

Finally, the visibility segments are returned in a VisibilityList object that is is a list of VisibilitySegment. A VisibilitySegment is a TimeSegment plus an extra information about the segment. That information depends on the way in which the segment was computed. To retrieve the extra information, it has to be called to the suitable method of VisibilitySegment. The following table shows the type of extra information that can be retrieved:

Visibility method Extra Info Class VisibilitySegment method to retrieve the info
zoneVisTimeCompute ZoneExtraInfo getZoneExtraInfo
stationVisTimeCompute StationExtraInfo getStationExtraInfo
mapping MappingExtraInfo getMappingExtraInfo
starVisTime StarExtraInfo getStarExtraInfo

Example

The following example shows how to get the zone visibility segments and how to retrieve the info from the segment list. Note that other visibility functions work in a similar way ( the example provided with the installation packages provides a more complete example). Note the following steps in the computation:

// ------------------------------------------------------------------------
//
//                           C++ Example Program.
//                           VISIBILITY CALCULATIONS
//
// ------------------------------------------------------------------------

// Non-EOCFI include files
#include <string>
#include <vector>
#include <iostream>

// EOCFI includes
#include "DataHandlingData.h"
#include "TimeCorrelation.h"
#include "ModelId.h"
#include "VisibilityData.h"
#include "AtmosId.h"
#include "Swath.h"
#include "OrbitId.h"
#include "VisibilityList.h"
#include "VisibilitySegment.h"
#include "SatId.h"
#include "StfFile.h"
#include "SdfFile.h"
#include "ZoneFile.h"

// Namespaces
using namespace EECFI;
using namespace std;

// Main program
int main (int argc, char *argv[])
{ 
  
  //-------------------------------------------------
  // Put all the code inside try-catch statements
  //  so, if something fails, an exception is thrown
  //-------------------------------------------------
  try
  {

    // ------------------------------------------------------------------------
    // Satellite Id, ModelId and TimeCorrelatins initialization 
    // ------------------------------------------------------------------------ 

    SatId satId(XPCFI_SAT_ENVISAT);

    ModelId          modelId; //Do nothing: using default models.

    double initTime[4];

    initTime[0]   = -245.1000000000000000;   // TAI time [days] 
    initTime[1]   = -245.0995949074074074;   // UTC time [days] (= TAI - 35.0 s) 
    initTime[2]   = -245.0995879629629630;   // UT1 time [days] (= TAI - 35.6 s) 
    initTime[3]   = -245.0997800925925926;   // GPS time [days] (= TAI - 19.0 s) 
    
    TimeCorrelation  timeId( initTime );

    // ------------------------------------------------------------------------ 
    // Initialise orbit Id                                        
    // ------------------------------------------------------------------------ 

    double time0, time1;
    long orbit0, orbit1;
  
    vector<string> inputFiles;

    long orbitMode    = XOCFI_ORBIT_INIT_OSF_MODE;
    long timeInitMode = XOCFI_SEL_FILE;
    long timeRef      = XOCFI_TIME_UTC;

    inputFiles.push_back( "./data/OSF.EEF" );

    OrbitId orbitId( satId, modelId, timeId, timeRef, orbitMode,
                     inputFiles, timeInitMode, time0, time1, orbit0, orbit1 );

    // ------------------------------------------------------------------------ 
    // Initialization of SwathId object (With Swath Definition file)
    // ------------------------------------------------------------------------ 
    AtmosId *atmosId = new AtmosId();
    
    SwathInfo swathInfo;
    string swathTempFile = "./RA_2___501_.N1";
    
    swathInfo.type = XVCFI_FILE_STF;
    swathInfo.filename = swathTempFile;
    SwathId swathId(*atmosId, swathInfo);
    
    Swath swathTemp( orbitId, swathTempFile );

    // ------------------------------------------------------------------------ 
    // Obtain zone visibility segments
    // ------------------------------------------------------------------------ 
    VisibilityList visList;

    string zoneDBFile  = "./ZONE_DB";
    string zoneId      = "ZANA____";
    
    AttitudeDef attDef;
    
    VisTime startTime(XVCFI_ORBIT_TYPE, 0., 1800, 0, 0);
    VisTime stopTime(XVCFI_ORBIT_TYPE,  0., 2300, 0, 0);
    
    VisTimeInterval searchInterval(startTime, stopTime);
    
    ZoneInfo zoneInfo;
    zoneInfo.zoneId = zoneId;
    zoneInfo.type = XVCFI_USE_ZONE_DB_FILE;
    zoneInfo.zoneDBFilename = zoneDBFile;
    zoneInfo.projection = XDCFI_GNOMONIC;
    zoneInfo.minDuration = 0.;
    
    ZoneInfoList zoneInfoList;
    zoneInfoList.calcFlag = XVCFI_COMPUTE;
    zoneInfoList.zoneInfo.push_back(zoneInfo);
    
    visList = swathTemp.zoneVisTimeCompute( attDef, swathId, zoneInfoList, searchInterval);

    // Show the last segment
    VisibilitySegment  lastSegment = visList[visList.size()-1];
    cout << "\tNumber of segments found for zone " 
         << zoneId << " = " 
         << visList.size() << endl;
    cout << "\tSegment " << visList.size() << ": ( " 
         << lastSegment.start.orbit        << ", " 
         << lastSegment.start.seconds      << ", " 
         << lastSegment.start.microseconds << " ) -> ( " 
         << lastSegment.stop.orbit         << ", " 
         << lastSegment.stop.seconds       << ", " 
         << lastSegment.stop.microseconds << " )" << endl;

    // ------------------------------------------------------------------------ 
    // Obtain zone visibility segments extra information, coverage for zoneVisTime
    // ------------------------------------------------------------------------ 
    ZoneExtraInfo zoneExtra;
    vector<long> covVec;

    for (long i = 0 ; i < visList.size(); i++ )
    {
      zoneExtra = visList[i].getZoneExtraInfo();
      covVec.push_back( zoneExtra.coverage );
    }
    
    cout << "\tCoverage for segment " << visList.size() 
         << " = " << covVec[covVec.size()-1] << endl;
    
    // Empty list
    visList.clear();
  }
  //end try

  catch (CfiError cfiError)
  {
    //If an exception is thrown, there have been errors during execution
    vector<string> errorMessages;
    
    // Get error messages
    cfiError.getMsg(errorMessages);

    // Pring Error messages
    for (long i = 0; i < errorMessages.size(); i++)
    {
      cout << errorMessages[i] << endl;
    }
  }

  return 0;

}

Generated on Mon Dec 11 2023 13:28:37 for by  doxygen 1.7.1