📄 xsvpeph.m
字号:
% xsvpeph.m
% Scope: This MATLAB program computes ECEF satellite position based on
% satellite ephemeris data; WGS-84 constants are used.
% Usage: xsveph
% Inputs: - tsim, GPS system time at time of transmission, i.e. GPS time
% corrected for transit time (range/speed of light), in seconds
% - satellite ephemeris data from a specified data file; default
% data are given. The ephemeris satellite data are specified in
% the following order (each record is for a different satellite):
% - satellite number
% - toe, reference time ephemeris, in seconds
% - smaxis, satellite semi-major axis (a), in meters
% - ecc, satellite eccentricity (e)
% - izero, inclination angle at reference time (I_0), in radians
% - razero, right ascension at reference time (OMEGA_0), in radians
% (longitude of ascending node of orbit plane at weekly epoch)
% - argper, argument of perigee (omega), in radians
% - mzero, mean anomaly at reference time (M_0), in radians
% - radot, rate of right ascension (OMEGA_DOT), in radians/second
% - deln, mean motion difference from computed value (delta_n), in
% radians/second
% - idot, rate of inclination angle (I_DOT), in radians/second
% - cic, amplitude of the cosine harmonic correction term to the
% angle of inclination, in radians
% - cis, amplitude of the sine harmonic correction term to the
% angle of inclination, in radians
% - crc, amplitude of the cosine harmonic correction term to the
% orbit radius, in meters
% - crs, amplitude of the sine harmonic correction term to the
% orbit radius, in meters
% - cuc, amplitude of the cosine harmonic correction term to the
% argument of latitude, in radians
% - cus, amplitude of the sine harmonic correction term to the
% argument of latitude, in radians
% - name of the input data file (optional)
% - name of the output file (optional)
% Outputs: - input/output data stored on the selected output file or
% displayed on screen
% External Matlab macros used: svpeph, wgs84con
% Last update: 11/11/00
% Copyright (C) 1996-00 by LL Consulting. All Rights Reserved.
clear
yes = 'y';
% Specify the ephemeris data for the satellite
disp(' ');
answer1 = input('Do you want to use the default data? (y/n)[y] ','s');
if isempty(answer1)
answer1 = yes;
end
disp(' ');
svid = [];
if (strcmp(answer1,yes) == 1)
tsim = 238205.; % GPS system time at time of transmission,
% i.e. GPS time corrected for transit time
% (range/speed of light), in seconds
eph(1) = 1; % default value
eph(2) = 244800.; % reference time ephemeris (toe), in seconds
eph(3) = 26560360.0409; % semi-major axis (a), in meters
eph(4) = 0.00528036116157; % satellite eccentricity (e)
eph(5) = 0.970306409202; % inclination angle at reference time (I_0),
% in radians
eph(6) = -3.09805209344; % right ascension at reference time (OMEGA_0),
% in radians (longitude of ascending node
% of orbit plane at weekly epoch)
eph(7) = 2.88898057517; % argument of perigee (omega), in radians
eph(8) = -0.784710884484; % mean anomaly at reference time (M_0),in rads.
eph(9) = -7.84889836669e-9; % rate of right ascension (OMEGA-DOT), in rad/s
eph(10) = 4.22624746874e-9; % mean motion difference from computed
% value (delta_n), in radians/second
eph(11) = -5.7145237e-12; % rate of inclination angle (I_DOT),in rad/sec.
eph(12) = 3.72529029846e-8; % cic, in radians
eph(13) = -2.421438694e-8; % cis, in radians
eph(14) = 176.59375; % crc, in meters
eph(15) = -72.09375; % crs, in meters
eph(16) = -3.73087823391e-6; % cuc, in radians
eph(17) = 1.07381492853e-5; % cus, in radians
nrow = 1;
else
tsim = input('Specify the time of simulation, tsim, e.g. 238205., --> ');
disp(' ');
fname = input('Specify the ephemeris data filename (with extension) --> ','s');
eph = load(fname);
[nrow,ncol] = size(eph);
if nrow ~= 17
disp('XSVPEPH - Error: check the input data ');
disp(' ');
break;
end
end
% Select the output file
answer2 = input('Do you want to save the generated data? (y/n)[y] ','s');
if isempty(answer2)
answer2 = yes;
end
disp(' ');
if strcmp(answer2,yes) == 1
f2 = input('Specify the output filename --> ','s');
else
f2 = 1; % output to the screen
end
disp(' ');
fprintf(f2,'******************************************************************\n');
fprintf(f2,'\n*****Simulation time = %16.7e seconds\n',tsim);
for k = 1:nrow
svid(k) = eph(k,1);
temp = eph(k,2:17);
% Compute the ECEF satellite position
pse = svpeph(tsim,temp);
% Save the generated data into a specified file or displayed on screen
fprintf(f2,'\n*****Satellite ephemeris data for satellite %3.0f\n',svid(k));
fprintf(f2,'toe = %22.14e seconds\n',eph(1));
fprintf(f2,'smaxis = %22.14e meters\n',eph(2));
fprintf(f2,'ecc = %22.14e \n',eph(3));
fprintf(f2,'izero = %22.14e radians\n',eph(4));
fprintf(f2,'razero = %22.14e radians\n',eph(5));
fprintf(f2,'argper = %22.14e radians\n',eph(6));
fprintf(f2,'mzero = %22.14e radians\n',eph(7));
fprintf(f2,'radot = %22.14e radians/second\n',eph(8));
fprintf(f2,'deln = %22.14e radians/second\n',eph(9));
fprintf(f2,'idot = %22.14e radians/second\n',eph(10));
fprintf(f2,'cic = %22.14e radians\n',eph(11));
fprintf(f2,'cis = %22.14e radians\n',eph(12));
fprintf(f2,'crc = %22.14e meters\n',eph(13));
fprintf(f2,'crs = %22.14e meters\n',eph(14));
fprintf(f2,'cuc = %22.14e radians\n',eph(15));
fprintf(f2,'cus = %22.14e radians\n\n',eph(16));
fprintf(f2,'ECEF position for the selected satellite %3.0f based on ',svid(k));
fprintf(f2,'ephemeris data\n');
fprintf(f2,'x-component = %22.14e meters\n',pse(1));
fprintf(f2,'y-component = %22.14e meters\n',pse(2));
fprintf(f2,'z-component = %22.14e meters\n\n',pse(3));
end
fprintf(f2,'******************************************************************\n\n');
disp('End of the program XSVPEPH ');
disp(' ');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -