Earth Observation Mission CFI Software Usage Guide for Object Oriented Software |
The following classes allow to convert On Board Time to MJD2000 time and vice versa:
The following example shows how to make this transformations in the case of Envisat OBT:
// ------------------------------------------------------------------------ // // C++ Example Program. // OBT OPERATIONS // // ------------------------------------------------------------------------ // Non-EOCFI include files #include <string> #include <vector> #include <iostream> // EOCFI includes #include "CfiError.h" #include "LibData.h" #include "EETime.h" #include "EnvisatObt.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 { // ------------------------------------------------------------------------ // OBT Time transformations // ------------------------------------------------------------------------ // Envisat OBT to time double time0 = 245.123456789000000; // [days] unsigned long obt0[2] = {0x00001001, 0x00011111}; unsigned long period0 = (unsigned long) ((1/256.0)*1.0E12); // [picoseconds] EnvisatObt enviOBT(time0, obt0, period0); enviOBT.obt[0] = 0xFFFF0FFF; enviOBT.obt[1] = 0x000FF000; Time timeFromOBT = enviOBT.getTime(); cout << "Input Time:" << endl; cout << " time0 = " << enviOBT.time0 << endl; cout << " obt0[0] = " << enviOBT.obt0[0] << endl; cout << " obt0[1] = " << enviOBT.obt0[1] << endl; cout << " period0 = " << enviOBT.period0 << endl; cout << " obt[0] = " << enviOBT.obt[0] << endl; cout << " obt[1] = " << enviOBT.obt[1] << endl; cout << "Output Time:" << endl; cout << " time = " << timeFromOBT.time << "Ref = " << timeFromOBT.ref << endl << endl; // Time to Envisat OBT time timeFromOBT.time = 245.120493735624819; EnvisatObt newEnviOBT(time0, obt0, period0); newEnviOBT.setObt(timeFromOBT); cout << "Input Time:" << endl; cout << " time = " << timeFromOBT.time << "Ref = " << timeFromOBT.ref << endl; cout << "Output Time:" << endl; cout << " time0 = " << newEnviOBT.time0 << endl; cout << " obt0[0] = " << newEnviOBT.obt0[0] << endl; cout << " obt0[1] = " << newEnviOBT.obt0[1] << endl; cout << " period0 = " << newEnviOBT.period0 << endl; cout << " obt[0] = " << newEnviOBT.obt[0] << endl; cout << " obt[1] = " << newEnviOBT.obt[1] << endl << 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; }