📄 ogr_riseset.c
字号:
/* ************************************************************************ * * * OpenGPS Receiver * * * * -------------------------------------------------------------------- * * * * Module: ogr_riseset.c * * * * Version: 0.1 * * * * Date: 05.08.03 * * * * Author: G. Beyerle * * * * -------------------------------------------------------------------- * * * * Copyright (C) 2001-2002 C. Kelley, 2003 G. 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 'ogr_user.c', 'ogr_navdecode.c', 'ogr_navsolve.c', * * 'ogr_rtproc.c' are modified versions of the files 'gpsfuncs.cpp', * * 'gpsrcvr.cpp' from Clifford Kelley's OpenSourceGPS distribution. * * The unmodified files can be obtained from * * http://www.home.earthlink.net/~cwkelley * * * * -------------------------------------------------------------------- * * * * Track setting and rising satellites * * * ************************************************************************ *//* ******************************* changes ******************************** dd.mm.yy - ************************************************************************ *//*********************************************************************** GPS RECEIVER (GPSRCVR) Ver. 1.02 12 Channel All-in-View GPS Receiver Program based on Mitel GP2021 chipset Clifford Kelley cwkelley@earthlink.net Copyright (c) 1996-2001 Clifford Kelley. All Rights Reserved. This LICENSE must be included with the GPSRCVR code.***********************************************************************//*Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions aremet: CONDITIONS1. Redistributions of GPSRCVR source code must retain the above copyrightnotice, this list of conditions, and the following disclaimer.2. Redistributions in binary form must contain the above copyrightnotice, this list of conditions and the following disclaimer in thedocumentation and/or other materials provided with the distribution.3. All modifications to the source code must be clearly marked assuch. Binary redistributions based on modified source code must beclearly marked as modified versions in the documentation and/or othermaterials provided with the distribution.4. Notice must be given of the location of the availability of theunmodified current source code, e.g., http://www.Kelley.com/or ftp://ftp.Kelley.comin the documentation and/or other materials provided with thedistribution.5. All advertising and published materials mentioning features or useof this software must display the following acknowledgment: "Thisproduct includes software developed by Clifford Kelley and othercontributors."6. The name of Clifford Kelley may not be used to endorse or promoteproducts derived from this software without specific prior writtenpermission. DISCLAIMERThis software is provided by Clifford Kelley and contributors "as is" andany expressed or implied warranties, including, but not limited to, theimplied warranties of merchantability and fitness for a particularpurpose are disclaimed. In no event shall Clifford Kelley orcontributors be liable for any direct, indirect, incidental, special,exemplary, or consequential damages (including, but not limited to,procurement of substitute goods or services; loss of use, data, orprofits; or business interruption) however caused and on any theory ofliability, whether in contract, strict liability, or tort (includingnegligence or otherwise) arising in any way out of the use of thissoftware, even if advised of the possibility of such damage.*//* ------------------------------- includes ------------------------------- */#include <stdio.h>#include <stdlib.h>#include <math.h>#include <string.h>#include <time.h>#include <assert.h>#include "port.h"#include "ogr_defines.h"#include "ogr_globals.h"#include "ogr_structs.h"/* ----------------------------- defines ---------------------------------- *//* ---------------------------- prototypen -------------------------------- *//* ----------------------------- globals ---------------------------------- *//* ---------------------------- procedures -------------------------------- *//* * cycle through all tracked sats and determine whether their * elevation angle increases or decreases */void find_rising_or_setting( int tr_ch_len, int tr_ch[], ECEF rcvr_pos, double Ttr){ INT16 n, ch, prn; double Trel, az, el, az_next, el_next, tOfs = 60; // time step is 1 min ECEF xmit_pos; for ( n=0; n<tr_ch_len; n++) { ch = tr_ch[n]; prn = Chan[ch].prn; xmit_pos = satellite_position( prn, Ttr, &Trel); sat_azimuth_elevation( xmit_pos, rcvr_pos, &az, &el); xmit_pos = satellite_position( prn, Ttr + tOfs, &Trel); sat_azimuth_elevation( xmit_pos, rcvr_pos, &az_next, &el_next);// if elevation angle decreases it must be a setting event if ( el_next < el) Xmit_Info[prn].riseset = -1; else Xmit_Info[prn].riseset = 1; } return; }/* * select sat to be tracked next */INT16 schedule_riseset( int tr_ch_len, int tr_ch[], ECEF rcvr_pos, double Ttr){ INT16 n, prn, prnmin = -1, nmin = -1; find_rising_or_setting( tr_ch_len, tr_ch, rcvr_pos, Ttr);// Ctrl->riseset_elev_min // Ctrl->riseset_elev_max// select for ( n=0; n<tr_ch_len; n++) { prn = Chan[tr_ch[n]].prn; if ( nmin < 0 && Xmit_Info[prn].riseset < 0) { nmin = n; prnmin = Chan[tr_ch[nmin]].prn; }// find tracked sat with lowest elevation if ( nmin >= 0 && Xmit_Info[prn].riseset < 0 && Xmit_Info[prn].elevation < Xmit_Info[prnmin].elevation ) { nmin = n; prnmin = Chan[tr_ch[nmin]].prn; } } return (prnmin);}/* ---------------------------- end of file ------------------------------- */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -