/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* */
/* EF18_SP3 */
/* ======== */
/* */
/* This program converts GPS orbit data from a 18-byte EF18 BINARY direct */
/* access file format to a 60_byte SP3 ASCII position file format for any */
/* specified interval from 1 microsecond to whatever. Various program */
/* functions and part of the program structure has been taken from */
/* Ben Remondi's ECF2_SP2.C program. */
/* */
/* REFERENCE: NOAA Technical Report NOS 133 NGS 46 */
/* Extending the NGS Standard GPS Orbit Formats */
/* Benjamin W. Remondi */
/* Rockville, MD */
/* November 1989 */
/* */
/* NGS Second generation ASCII and binary orbit */
/* formats and associated interpolation studies */
/* Benjamin W. Remondi */
/* Rockville, MD */
/* August 1991 */
/* */
/* U.S. Department of Commerce */
/* National Oceanic and Atmospheric Administration */
/* National Ocean Service */
/* */
/* PROGRAMMERS: Benjamin W. Remondi */
/* Rockwall I, Room 315 */
/* 11400 Rockville Pike */
/* Rockville, MD 20852 */
/* 443-8171, 443-5959 */
/* */
/* DATE: June 1, 1990 */
/* */
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <dir.h>
#include <dos.h>
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#define TRUE 1
#define FALSE 0
#define SW_VERSION "1.1.0b"
#define WS_RELEASED "05/20/94"
#define INFO_DELAY 1000
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#define LU_ELBOW 201
#define RU_ELBOW 187
#define LL_ELBOW 200
#define RL_ELBOW 188
#define VERTICAL 186
#define HORIZONTAL 205
#define TEX_WDTH 76
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
FILE *fpsp3, *fpef18;
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
static char config_fname[100];
static int dflt_menu_clrs = TRUE;
char prog_name[MAXFILE];
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
struct run_time { char idsv[85];
char SV_acc[85];
long gpswk_strt, gpswk_end,
mjd_strt, mjd_end;
double secofwk_strt, secofwk_end,
fmjd_strt, fmjd_end;
long yr_strt, yr_end,
month_strt, month_end,
mday_strt, mday_end,
hr_strt, hr_end,
min_strt, min_end;
double sec_strt, sec_end,
time_span, delta_t;
long num_epochs;
int num_prns;
char pva;
} run;
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
static struct header_lines
{ int year;
char month, day, hour, minute;
double second;
long nepoch;
char data_used[5], coordsys[5], orb_type[3];
char agency[4], version;
int GPS_week_strt;
double second_of_week, epoch_interval;
long mjd_strt;
double fmjd_strt;
char number_of_SVs, pva, spareB[4];
char idsv[85], spareC[5];
char SV_acc[85], spareD[5];
char ca[2], cb[2], cc[3], cd[3], ce[4], cf[4], cg[4], ch[4],
ci[5], cj[5], ck[5], cl[5], spareE[8];
char cm[2], cn[2], co[3], cp[3], cq[4], cr[4], cs[4], ct[4],
cu[5], cv[5], cw[5], cx[5], spareF[8];
double fa, fb;
char spareG[2];
double fc, fd;
char spareH[2];
double fe, ff;
char spareI[2];
double fg, fh;
char spareJ[2];
int ia2;
long ib4, ic4, id4, ie4, if4, ig4, ih4, ii4;
char spareK[2];
int ij2;
long ik4, il4, im4, in4, io4, ip4, iq4, ir4;
char spareL[2];
char line29[18], line30[18], line31[18], line32[3],
spareM[15], line33[18], line34[18], line35[18], line36[3],
spareN[15], line37[18], line38[18], line39[18], line40[3],
spareO[15], line41[18], line42[18], line43[18], line44[3],
spareP[15];
} ef18_hdr;
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
static struct xyz_lines
{ char xyz_good_or_bad, clock_good_or_bad;
long x, y, z, clock;
} ef18;
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
static char sp3_line[82];
int dummy;
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void main (int argc, char *argv[])
{{
void extract_args (char *fname, int argc, char *argv[]);
void user_entry(void);
void open_sp3_and_ef18_files_and_read(void);
void change_ef18_headr_lines_to_sp3(void);
void change_ef18_epoch_lines_to_sp3(void);
long tim;
extract_args (config_fname, argc, argv);
system(" cls ");
open_sp3_and_ef18_files_and_read();
user_entry();
tim = time(0);
change_ef18_headr_lines_to_sp3();
change_ef18_epoch_lines_to_sp3();
printf("\nTime: %ld seconds\n", time(0) - tim);
fprintf(fpsp3, "%.3s\n", "EOF");
}}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void user_entry(void)
{
void ymdhms_to_gps(long, long, long, long, long, double, long *, double *);
void gps_to_mjd(long, double, long *, double *);
short verify_and_add_acc(long, char);
long ii, jj;
short svexists;
printf("Enter ephemeris start: yyyy mm dd hh mm ss.sssssss\n");
scanf("%ld %ld %ld %ld %ld %lf", &run.yr_strt, &run.month_strt,
&run.mday_strt, &run.hr_strt, &run.min_strt, &run.sec_strt );
printf("Enter ephemeris end: yyyy mm dd hh mm ss.sssssss\n");
scanf("%ld %ld %ld %ld %ld %lf", &run.yr_end, &run.month_end,
&run.mday_end, &run.hr_end, &run.min_end, &run.sec_end );
/* Compute time span*/
ymdhms_to_gps(run.yr_strt, run.month_strt, run.mday_strt, run.hr_strt,
run.min_strt, run.sec_strt, &run.gpswk_strt, &run.secofwk_strt);
gps_to_mjd(run.gpswk_strt, ru
- 1
- 2
- 3
前往页