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

📄 ogsinout.c

📁 OpenGPSSim是一个gps模拟程序
💻 C
📖 第 1 页 / 共 2 页
字号:
/* ************************************************************************ 
   *                                                                      *
   *                          GPS Simulation                              *
   *                                                                      *
   * -------------------------------------------------------------------- *
   *                                                                      *
   *    Module:   ogsinout.cpp                                            *
   *                                                                      *
   *   Version:   0.1                                                     *
   *                                                                      *
   *      Date:   17.02.02                                                *
   *                                                                      *
   *    Author:   G. Beyerle                                              *
   *                                                                      *
   * -------------------------------------------------------------------- *
   *                                                                      *
   * Copyright (C) 2002  Georg Beyerle                                    *
   *                                                                      *
   * This program is free software; you can redistribute it and/or modify *
   * it under the terms of the GNU General Public License as published by *
   * the Free Software Foundation; either version 2 of the License, or    *
   * (at your option) any later version.                                  *
   *                                                                      *
   * This program is distributed in the hope that it will be useful,      *
   * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
   * GNU General Public License for more details.                         *
   *                                                                      *
   * You should have received a copy of the GNU General Public License    *
   * along with this program; if not, write to the Free Software          *
   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
   *                                                                      *
   * -------------------------------------------------------------------- *
   *                                                                      *
   * The files 'gpsfuncs.cpp', 'gpsrcvr.cpp' are modified versions of     *
   * the files with the same name from Clifford Kelley's OpenSourceGPS    *
   * distribution. The unmodified files can be obtained from              *
   *   http://www.home.earthlink.net/~cwkelley                            *
   *                                                                      *
   * -------------------------------------------------------------------- *
   *                                                                      *
   *                         I/O - Procedures                             *
   *                                                                      *
   ************************************************************************ */

/* ******************************* changes ********************************

   dd.mm.yy -

   ************************************************************************ */

/* ------------------------------- includes ------------------------------- */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <assert.h>

#include "ogsdefine.h"
#include "ogsstructs.h"
#include "ogsextern.h"
#include "ogsprototypes.h"
#include "ogslibrary.h"

/* ------------------------------- defines -------------------------------- */

/* ------------------------------- globals -------------------------------- */

/* -------------------------- prototypen (global) ------------------------- */

/* ------------------------------ procedures ------------------------------ */

void write_sf1to3( NAVDATA *nav, FILE *fp)
{
  fprintf( fp, "# --- subframe 1-3 : satellite clock, health data and ephemeris data ---\n");
  fprintf( fp, "satellite data valid                                 valid = %e\n", nav->valid);
  fprintf( fp, "week number                                           week = %e\n", nav->weekno);
  fprintf( fp, "hand over word                                         how = %e\n", nav->how);
  fprintf( fp, "satellite health                                    health = %e\n", nav->health);
  fprintf( fp, "user range accuracy index                              ura = %e\n", nav->gps_eph.ura);
  fprintf( fp, "issue of date, clock                                  iodc = %e\n", nav->gps_eph.iodc);
  fprintf( fp, "issue of date, ephemeris                              iode = %e\n", nav->gps_eph.iode);
  fprintf( fp, "satellite group delay differential               tgd [sec] = %e\n", nav->gps_eph.tgd);
  fprintf( fp, "clock data reference time                        toc [sec] = %e\n", nav->gps_eph.toc);
  fprintf( fp, "reference time ephemeris                               toe = %e\n", nav->gps_eph.toe);
  fprintf( fp, "clock polynomial correction parameter 2    af2 [sec/sec^2] = %e\n", nav->gps_eph.af2);
  fprintf( fp, "clock polynomial correction parameter 1      af1 [sec/sec] = %e\n", nav->gps_eph.af1);
  fprintf( fp, "clock polynomial correction parameter 0          af0 [sec] = %e\n", nav->gps_eph.af0);
  fprintf( fp, "mean motion correction                                  dn = %e\n", nav->gps_eph.dn);
  fprintf( fp, "rate of right ascension                           omegadot = %e\n", nav->gps_eph.omegadot);
  fprintf( fp, "rate of inclination angle                             idot = %e\n", nav->gps_eph.idot);
  fprintf( fp, "amplitude of cosine harm. corr. to arg. of latitude    cuc = %e\n", nav->gps_eph.cuc);
  fprintf( fp, "amplitude of sine harm. corr. to arg. of latitude      cus = %e\n", nav->gps_eph.cus);
  fprintf( fp, "amplitude of cosine harm. corr. to orbit radius        crc = %e\n", nav->gps_eph.crc);
  fprintf( fp, "amplitude of sine harm. corr. to orbit radius          crs = %e\n", nav->gps_eph.crs);
  fprintf( fp, "amplitude of cosine harm. corr. to angle of incl.      cic = %e\n", nav->gps_eph.cic);
  fprintf( fp, "amplitude of sine harm. corr. to angle of inclination  cis = %e\n", nav->gps_eph.cis);
  fprintf( fp, "mean anomaly at reference time                          ma = %e\n", nav->gps_eph.ma);
  fprintf( fp, "eccentricity                                             e = %e\n", nav->gps_eph.ety);
  fprintf( fp, "square root of semi-major axis                sqra [m^1/2] = %e\n", nav->gps_eph.sqra);
  fprintf( fp, "lon. asc. node of orbit plane at weekly epoch       omega0 = %e\n", nav->gps_eph.omega0);
  fprintf( fp, "inclination angle at reference time                   inc0 = %e\n", nav->gps_eph.inc0);
  fprintf( fp, "argument of perigee                                      w = %e\n", nav->gps_eph.w);
  return;
}

void read_sf1to3( NAVDATA *nav, FILE *fp)
{
  fgets( fp);
  fscanf( fp, "%*60c%e\n", nav->valid);
  fscanf( fp, "%*60c%e\n", nav->weekno);
  fscanf( fp, "%*60c%e\n", nav->how);
  fscanf( fp, "%*60c%e\n", nav->health);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.ura);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.iodc);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.iode);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.tgd);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.toc);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.toe);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.af2);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.af1);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.af0);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.dn);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.omegadot);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.idot);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.cuc);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.cus);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.crc);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.crs);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.cic);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.cis);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.ma);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.ety);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.sqra);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.omega0);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.inc0);
  fscanf( fp, "%*60c%e\n", nav->gps_eph.w);
  return;
}

# --- subframe 4 : support data ---
page number                                         = 

void write_sf4( NAVDATA *nav, int pageno, FILE *fp)
{

⌨️ 快捷键说明

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