//! SGP4 constructor. /*! \param tle Two Line Elements \param int GravConst 0 = WGS72, 1 = WGS82 initializes the Orbit-Calculation model */ public Sgp4(Tle data, int wgsConstant) { setGrav(wgsConstant); tleElementData = data; satCalcData = new Sgp4Rec(); resultOrbitData = new List<Sgp4Data>(); //Load TLE Data in sg4Rec Class for calculation satCalcData.rec_satnum = data.getSatNumber(); satCalcData.rec_epochyr = data.getEpochYear(); satCalcData.rec_epochdays = data.getEpochDay(); satCalcData.rec_bstar = data.getDrag(); satCalcData.rec_inclo = data.getInclination(); satCalcData.rec_omegao = data.getRightAscendingNode(); satCalcData.rec_ecco = data.getEccentriciy(); satCalcData.rec_argpo = data.getPerigee(); satCalcData.rec_mo = data.getMeanAnomoly(); satCalcData.rec_no = data.getMeanMotion(); satCalcData.rec_no = satCalcData.rec_no / xpdotp; satCalcData.rec_a = Math.Pow(satCalcData.rec_no * tumin, (-2.0 / 3.0)); satCalcData.rec_ndot = satCalcData.rec_ndot / (xpdotp * 1440.0); satCalcData.rec_nddot = satCalcData.rec_nddot / (xpdotp * 1440.0 * 1440); satCalcData.rec_inclo = satCalcData.rec_inclo / rad; satCalcData.rec_omegao = satCalcData.rec_omegao / rad; satCalcData.rec_argpo = satCalcData.rec_argpo / rad; satCalcData.rec_mo = satCalcData.rec_mo / rad; //Initalize newton rhapson iteration newtonm(satCalcData.rec_ecco, satCalcData.rec_mo, e1, nuo); satCalcData.rec_alta = satCalcData.rec_a * (1.0 + satCalcData.rec_ecco * satCalcData.rec_ecco) - 1.0; satCalcData.rec_altp = satCalcData.rec_a * (1.0 - satCalcData.rec_ecco * satCalcData.rec_ecco) - 1.0; //check Yeahr to find the the right Date //Currently will only work until 2058 //Currently oldest man made object Vangard1 Launched 1958 if (satCalcData.rec_epochyr < 58) year = satCalcData.rec_epochyr + 2000; else year = satCalcData.rec_epochyr + 1900; // Epoch time satCalcData.rec_eptime = (year - 1950) * 365 + (year - 1949) / 4 + satCalcData.rec_epochdays; EpochTime satTime = new EpochTime(satCalcData.rec_epochyr, satCalcData.rec_epochdays); satCalcData.rec_mjdsatepoch = satTime.toJulianDate(); satCalcData.rec_mjdsatepoch = satCalcData.rec_mjdsatepoch - 2400000.5; satCalcData.rec_init = 1; satCalcData.neo.neo_t = 0.0; sgp4Init(satCalcData.rec_satnum, year, satCalcData.rec_mjdsatepoch - 33281.0); //end; }