⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainn.cpp

📁 利用广播星历计算卫星轨道坐标
💻 CPP
字号:
#include<fstream>
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<iomanip>
#include"myStruct.h"
extern void readNfile(vector<nav_sat>&,char *);
extern void sat_pos(int&,double& ,double& ,sta_polar& ,vector<nav_sat>&);
time_gps GregToGps(time_calendar tc);//声明时间转换
//----------------------Read N File---------------------------------
int main()
{
	ofstream outfile1("坐标.txt",ios::out|ios::app);
	char igr[20]="sum of prn1.07N",*p1;
	p1=igr;
	//cout<<"Enter O file name:";
	//scanf("%s",p1);
	//ifstream infile1(p1,ios::in);

	vector<nav_sat> vn;
	readNfile(vn,p1);
	cout<<"文件循环vn.size="<<vn.size()<<endl;
	cout<<"-------------n file is ok-----------"<<endl;
	int posk=0;
	double t=15,tr=0;//t单位分钟,tr没意义
	sta_polar ps;
	
	//ofstream outfile1("坐标.txt",ios::out|ios::app);
	outfile1.precision(15);
	for(int i=0;i<vn.size();i++)
	{
		for(t=-45;t<=60;t=t+15)
		{
			sat_pos(i,t,tr,ps,vn);
			cout<<setprecision(15);
			outfile1<<ps.Ap<<endl;
		}
	}
	//////////////////////////
	


outfile1.close();
return 0;
}


//格里高历转GPS时间
time_gps GregToGps(time_calendar tc)
{
		double JD,h,yr,mth,WN,TOW;
		time_gps tg;
		if(tc.month>2) {yr=tc.year;mth=tc.month;}
		else {yr=tc.year-1;mth=tc.month+12;}
		if(yr>10) yr+=1900;
		else yr+=2000;
		h=tc.hour+tc.minute/60.0+tc.second/3600.0;	
		JD=floor(365.25*yr)+floor(30.6001*(mth+1))+tc.day+h/24.0+1720981.5;	
		WN=floor((JD-2444244.5)/7.0);
		TOW=(JD-2444244.5-7*WN)*86400.0;
		tg.num_week=WN;tg.num_sec=TOW;
		return tg;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -