Earth Observation Mission CFI Software Usage Guide for Object Oriented Software |
The Earth Observation CFI software contain clases to do computations related to orbits. Before doing any computation, the orbital information has to be stored in an object of the OrbitId class (See [ORBIT_SUM]).
After creating the OrbitId object, it allows the following operations:
The strategy to follow for initialising the orbit and the afterward usage can be summarize in the following steps:
Among the funcionalities provided by the OrbitId, one of the most important is the computation of state vectors at a given time (OrbitId::osvCompute). This computation depends on the way that the OrbitId was constructed. Please, refer to the documentation of this function for further info ([ORBIT_SUM]).
The Orbit library contais a class called ANXTime. This class consist on an orbit number and a time that represents the elapsed time since the satellite passed the ascending node (ANX). This class has the following characteristics:
Another useful class within the Orbit library, is the TimeSegment class. This class consist on a pair of ANXTime objects that represent the start and stop of an interval of time. This class is important as the Visibility functions in the Visibility library return lists of TimeSegment objects.
// ------------------------------------------------------------------------ // // C++ Example Program. // ORBIT COMPUTATIONS // // ------------------------------------------------------------------------ // Non-EOCFI include files #include <string> #include <vector> #include <iostream> // EOCFI includes #include "CfiError.h" #include "TimeCorrelation.h" #include "OrbitData.h" #include "OrbitFunc.h" #include "OrbitId.h" #include "TimeSegment.h" #include "ANXTime.h" #include "RelTimeSegment.h" #include "RelANXTime.h" // Namespaces using namespace EECFI; using namespace std; // Main program int main (int argc, char *argv[]) { // Accessors data vector<OsvRec> osvRecords; vector<OsfRecords> osfRecords; ValidityTime valTime; vector<ANXExtra> extraInfo; string orbitFile; // common variables long satId = XLCFI_SAT_CRYOSAT; double time0, time1; long orbit0, orbit1; // xo_timeTo_orbit & xo_orbito_time variables long orbit, seconds, microseconds; double timeT; long timeRef; long absOrbit; double pos[3], vel[3]; // orbit initilization long timeMode, orbit_mode, orbitMode; vector<string> filesVector; long status; int jj; //------------------------------------------------- // Put all the code inside try-catch statements // so, if something fails, an exception is thrown //------------------------------------------------- try { ModelId modelId; // Initializing Time Reference: Used for the first and second example double coorTime[4]; coorTime[0] = -1100.1000000000000; // TAI time [days] coorTime[1] = -1100.0995949074074; // UTC time [days] (= TAI + 35.0 s) coorTime[2] = -1100.0995914351852; // UT1 time [days] (= TAI + 35.3 s) coorTime[3] = -1100.099780092; // GPS time [days] (= TAI + 19.0 s) TimeCorrelation timeCorr(coorTime); // ------------------------------------------------------------------------ // Orbit initialization. Example1: One state vector //------------------------------------------------------------------------- // Initialize OrbitId with timeT = 3460.; timeRef = XLCFI_TIME_UT1; pos[0] = 6500000.; pos[1] = 2000000.; pos[2] = 0.; vel[0] = 463.; vel[1] = -1600.; vel[2] = 7300.; absOrbit = 2; OrbitId orbitId1( SatId(satId), modelId, timeCorr, timeRef, timeT, pos, vel, absOrbit ); // Get OSV records osvRecords = orbitId1.getOsv(); cout << "OrbitId::getOsv: Number of OSV records = " << osvRecords.size() << endl; for (jj = 0 ; jj < osvRecords.size() ; jj++) { cout << "\tOSV record " << jj << ": Tai time = " << osvRecords[jj].taiTime << endl; cout << "\tOSV record " << jj << ": Utc time = " << osvRecords[jj].utcTime << endl; cout << "\tOSV record " << jj << ": Ut1 time = " << osvRecords[jj].ut1Time << endl; cout << "\tOSV record " << jj << ": Abs orbit = " << osvRecords[jj].absOrbit << endl; cout << "\tOSV record " << jj << ": Ref frame = " << osvRecords[jj].refFrame << endl; cout << "\tOSV record " << jj << ": Position = ( " << osvRecords[jj].position[0] << ", " << osvRecords[jj].position[1] << ", " << osvRecords[jj].position[2] << " )" << endl; cout << "\tOSV record " << jj << ": Velocity = ( " << osvRecords[jj].velocity[0] << ", " << osvRecords[jj].velocity[1] << ", " << osvRecords[jj].velocity[2] << " )" << endl; cout << "\tOSV record " << jj << ": Quality = " << osvRecords[jj].quality << endl; cout << endl; } // ------------------------------------------------------------------------ // Orbit initialization. Example2: Orbit Scenario File //------------------------------------------------------------------------- // Set input values orbitFile = "./osf.xml"; satId = XLCFI_SAT_CRYOSAT; timeRef = XLCFI_TIME_UT1; orbit_mode = XOCFI_ORBIT_INIT_OSF_MODE; timeMode = XOCFI_SEL_FILE; // Create vector with input files filesVector.clear(); filesVector.push_back( orbitFile ); OrbitId orbitId2( SatId(satId), modelId, timeCorr, timeRef, orbit_mode, filesVector, timeMode, time0, time1, orbit0, orbit1 ); // Get status of OrbitId status = orbitId2.status(); cout << "OrbitId->status: Status = " << status << endl; // Get Satellite Id SatId satId = orbitId2.satId(); cout << "OrbitId->satId: satellite = " << satId.getSatellite() << endl; // Get Mode orbitMode = orbitId2.mode(); cout << "OrbitId->orbitId: mode = " << orbitMode << endl; // Get OSF records osfRecords = orbitId2.getOsf(); cout << "OrbitId->getOsf: Number of records = " << osfRecords.size() << endl; for (jj = 0 ; jj < osfRecords.size() ; jj++) { cout << endl; cout << "\tOSF record " << jj << ": Mission info - abs orbit = " << osfRecords[jj].missionInfo.absOrbit << endl; cout << "\tOSF record " << jj << ": Mission info - rel orbit = " << osfRecords[jj].missionInfo.relOrbit << endl; cout << "\tOSF record " << jj << ": Mission info - cycle = " << osfRecords[jj].missionInfo.cycle << endl; cout << "\tOSF record " << jj << ": Mission info - phase = " << osfRecords[jj].missionInfo.phase << endl; cout << "\tOSF record " << jj << ": Reference orbit info - drift mode = " << osfRecords[jj].refOrbitinfo.driftMode << endl; cout << "\tOSF record " << jj << ": Reference orbit info - inclination = " << osfRecords[jj].refOrbitinfo.inclination << endl; cout << "\tOSF record " << jj << ": Reference orbit info - rep cycle = " << osfRecords[jj].refOrbitinfo.repCycle << endl; cout << "\tOSF record " << jj << ": Reference orbit info - cycle length = " << osfRecords[jj].refOrbitinfo.cycleLength << endl; cout << "\tOSF record " << jj << ": Reference orbit info - ANX long = " << osfRecords[jj].refOrbitinfo.AnxLong << endl; cout << "\tOSF record " << jj << ": Reference orbit info - MLST = " << osfRecords[jj].refOrbitinfo.mlst << endl; cout << "\tOSF record " << jj << ": Reference orbit info - MLST drift = " << osfRecords[jj].refOrbitinfo.mlstDrift << endl; // [...] } // Get validity time valTime = orbitId2.getValTime(); cout << endl; cout << "OrbitId::getValTime : validity start = " << valTime.start << endl; cout << "OrbitId::getValTime : validity stop = " << valTime.stop << endl; // ------------------------------------------------------------------------ // Getting info from the OrbitId. //------------------------------------------------------------------------- long absOrbit, relOrbit, cycle, phase; OrbitalInfo orbitalInfo; OrbitInfo orbitInfo1, orbitInfo2, orbitInfo3; // 1. Get orbital info absOrbit = 300; orbitalInfo = orbitId2.getOrbitInfo( absOrbit ); cout << endl; cout << "ANX longitude = " << orbitalInfo.phasing << " deg" << endl; cout << "UTC at ANX = " << orbitalInfo.utcAnx << endl; cout << "Nodal period = " << orbitalInfo.nodalPeriod << " s" << endl; // [...] // 2. Get relative orbit and phase from the absolute orbit number absOrbit = 2800; orbitInfo1 = orbitId2.getOrbitNumbersFromAbs( absOrbit ); cout << "Absolute orbit = " << orbitInfo1.absOrbit << endl; cout << "Relative orbit = " << orbitInfo1.relOrbit << endl; cout << "Cycle = " << orbitInfo1.cycle << endl; cout << "Phase = " << orbitInfo1.phase << endl; // 3. Get absolute orbit from relative relOrbit = orbitInfo1.relOrbit; cycle = orbitInfo1.cycle; orbitInfo2 = orbitId2.getOrbitNumbersFromRel( relOrbit, cycle ); cout << "Absolute orbit = " << orbitInfo2.absOrbit << endl; cout << "Relative orbit = " << orbitInfo2.relOrbit << endl; cout << "Cycle = " << orbitInfo2.cycle << endl; cout << "Phase = " << orbitInfo2.phase << endl; // 4. Get absolute orbit from phase phase = orbitInfo2.phase; orbitInfo3 = orbitId2.getOrbitNumbersFromPhase( phase ); cout << "Absolute orbit = " << orbitInfo3.absOrbit << endl; cout << "Relative orbit = " << orbitInfo3.relOrbit << endl; cout << "Cycle = " << orbitInfo3.cycle << endl; cout << "Phase = " << orbitInfo3.phase << endl; // ------------------------------------------------------------------------ // Propagate the orbit: osvCompute //------------------------------------------------------------------------- long mode; double time; StateVector sv; StateVectorExtraInfo svExtra; // Computing the satellite position for the 01-01-2000 00:00:00 time = 0; sv = orbitId2.osvCompute( mode, timeRef, time); cout << "Input time = " << time << endl; cout << "Position = ( " << sv.coord.pos[0] << ", " << sv.coord.pos[1] << ", " << sv.coord.pos[2] << " )" << endl; cout << "Velocity = ( " << sv.coord.vel[0] << ", " << sv.coord.vel[1] << ", " << sv.coord.vel[2] << " )" << endl; cout << "Acceleration = ( " << sv.coord.acc[0] << ", " << sv.coord.acc[1] << ", " << sv.coord.acc[2] << " )" << endl; // Get orbital info related to the propagated time mode = XOCFI_ORBIT_EXTRA_ALL_RESULTS; svExtra = orbitId2.osvComputeExtra( mode ); cout << "Satellite geocentric position" << endl; cout << " Longitude = " << svExtra.modelIndep[XOCFI_ORBIT_EXTRA_GEOC_LONG] << endl; cout << " Latitude = " << svExtra.modelIndep[XOCFI_ORBIT_EXTRA_GEOD_LAT] << endl; cout << " Altitude = " << svExtra.modelIndep[XOCFI_ORBIT_EXTRA_GEOD_ALT] << endl; // [...] // ------------------------------------------------------------------------ // Using ANXTime objects //------------------------------------------------------------------------- orbit = 500; seconds = 0; microseconds = 0; timeRef = XLCFI_TIME_UT1; // ANXTime constructor ANXTime anxTime(orbitId2, 500, 0, 0); // Get equivalent time timeT = anxTime.orbitToTime( timeRef ); cout << "ANXTime::orbitToTime : orbit = " << orbit << " seconds = " << seconds << " microseconds = " << microseconds << " => time = " << timeT << endl; timeT += 1; // adding 1 day // ANXTime constructor anxTime.timeToOrbit( timeRef, timeT ); cout << endl; cout << "ANXTime::orbitToTime : time = " << timeT << " => orbit = " << anxTime.orbit << " seconds = " << anxTime.seconds << " microseconds = " << anxTime.microseconds << endl; }//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; }