int main(int argc, char* argv[]) { // Test SGP4 string str1 = "SGP4 Test"; string str2 = "1 88888U 80275.98708465 .00073094 13844-3 66816-4 0 8"; string str3 = "2 88888 72.8435 115.9689 0086731 52.6988 110.5714 16.05824518 105"; cTle tle1(str1, str2, str3); PrintPosVel(tle1); printf("\n"); // Test SDP4 str1 = "SDP4 Test"; str2 = "1 11801U 80230.29629788 .01431103 00000-0 14311-1 8"; str3 = "2 11801 46.7916 230.4354 7318036 47.4722 10.4117 2.28537848 6"; cTle tleSDP4(str1, str2, str3); PrintPosVel(tleSDP4); printf("\nExample output:\n"); // Example: Define a location on the earth, then determine the look-angle // to the SDP4 satellite defined above. // Create an orbit object using the SDP4 TLE object. cOrbit orbitSDP4(tleSDP4); // Create an ECI object to hold the location of the satellite cEci eciSDP4; // Get the location of the satellite from the Orbit object. The // earth-centered inertial information is placed into eciSDP4. // Here we ask for the location of the satellite 90 minutes after // the TLE epoch. orbitSDP4.getPosition(90.0, &eciSDP4); // Now create a site object. Site objects represent a location on the // surface of the earth. Here we arbitrarily select a point on the // equator. cSite siteEquator(0.0, -100.0, 0); // 0.00 N, 100.00 W, 0 km altitude // Now get the "look angle" from the site to the satellite. // Note that the ECI object "eciSDP4" contains a time associated // with the coordinates it contains; this is the time at which // the look angle is valid. cCoordTopo topoLook = siteEquator.getLookAngle(eciSDP4); // Print out the results. Note that the Azimuth and Elevation are // stored in the cCoordTopo object as radians. Here we convert // to degrees using rad2deg() printf("AZ: %.3f EL: %.3f\n", rad2deg(topoLook.m_Az), rad2deg(topoLook.m_El)); }
void CSatNote::ListInitial(TLE tle) { if(m_satInfo.GetSelCount()!=0) { m_satInfo.ResetContent(); } cTle tle1(tle.name,tle.line1,tle.line2);//采用SDP模型计算 cOrbit orbit(tle1); /////////////////////////////////////////////////////// string syear= tle.line1.substr(9,2); char *cyear = (char *)syear.c_str(); int year=atoi(cyear); if(year>57) //判断具体年份 year+=1900; else year+=2000; ////////////////////////////////////// double p_motion =orbit.mnMotion()*2*PI/(24*3600);//平均角速度 double a =pow(GM/(p_motion*p_motion),1/3.0);//长半径 /////////////////////////////////////////// CString str1,str2,str3,str4,str5,str6,str7,str8,str9; CString str11,str22,str33,str44,str55,str66,str77,str88,str99;//字符相加不能以常字符开始 str11="发射年份: "; str22="升交点赤经:"; str33="轨道倾角: "; str44="长半轴: "; str55="偏心率: "; str66="近地点角距:"; str77="平近点角: "; str88="周期: "; str99="近地点距离:"; str1.Format("%d",year); str1=str11+str1; str2.Format("%.4lf",orbit.RAAN()*180/PI); str2=str22+str2+"度"; str3.Format("%.4lf",orbit.Inclination()*180/PI); str3=str33+str3+"度"; str4.Format("%.4lf",a); str4=str44+str4+"km"; str5.Format("%.7lf",orbit.Eccentricity()); str5=str55+str5; str6.Format("%.4lf",orbit.ArgPerigee()*180/PI); str6=str66+str6+"度"; str7.Format("%.4lf",orbit.mnAnomaly()*180/PI); str7=str77+str7+"度"; str8.Format("%.4lf",orbit.Period()/(60*60*24.0)); str8=str88+str8+"天"; str9.Format("%.4lf",orbit.Perigee()); str9=str99+str9+"km"; m_satInfo.AddString(str1); m_satInfo.AddString(str2); m_satInfo.AddString(str3); m_satInfo.AddString(str4); m_satInfo.AddString(str5); m_satInfo.AddString(str6); m_satInfo.AddString(str7); m_satInfo.AddString(str8); m_satInfo.AddString(str9); }