source: ntrip/trunk/BNC/RTIGS/gpswro.h@ 1415

Last change on this file since 1415 was 661, checked in by mervart, 17 years ago

* empty log message *

File size: 3.1 KB
Line 
1
2/***************************************************************************
3 gpswro.h - description
4 -------------------
5 begin : Tue Mar 7 2000
6 copyright : (C) 2000 by Ken MacLeod
7 email : macleod@geod.nrcan.gc.ca
8 ***************************************************************************/
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18/*-------------------------------------------------------------------------*/
19/* Name : gpswro.h */
20
21/* Purpose : definitions for GPS week rollover functions. */
22
23/* The sliding window technique is implemented to unroll week */
24/* and seconds since week 0. It is implemented with */
25/* ROLL_NUMBER, GPSWK_LIMIT and GPSEC_LIMIT. */
26
27/* ROLL_NUMBER defines the sequence number of week rollover */
28/* i.e. ROLL_NUMBER 1 is week 1024, ROLL_NUMBER 2 is 2048, */
29/* etc. The GPSWK_LIMIT is such that unrolling will give: */
30
31/* week%1024 + ROLL_NUMBER * 1024 for week%1024 < GPSWK_LIMIT */
32/* week%1024 + (ROLL_NUMBER-1) * 1024 for week%1024 >= GPSWK_LIMIT */
33
34/* Example: with ROLL_NUMBER=2 and GPSWK_LIMIT=970, the */
35/* following will occur: */
36
37/* Input Unroll Roll */
38/* 970+n*1024 1994 970 */
39/* 1023+n*1024 2047 1023 */
40/* 0+n*1024 2048 0 */
41/* 969+n*1024 3017 969 */
42
43/* This means the only possible output of unrolled weeks lie */
44/* in the [1994,3017] interval spanning 1023 weeks, whatever */
45/* the input. This interval is defined by ROLL_NUMBER and */
46/* GPSWK_LIMIT. */
47
48/* The (un)rolling of GPS seconds since week 0 is done in the */
49/* same manner and uses the same limit. */
50
51/* RCS: $Header: gpswro.h,v 3.1 99/06/08 15:59:41 lahaye Released $ */
52
53/* Externals : */
54/*-------------------------------------------------------------------------*/
55
56#ifndef _GPSWRO_H
57
58#define _GPSWRO_H
59
60#define ROLL_NUMBER (1) /* User definition */
61#define GPSWK_LIMIT (970) /* User definition */
62
63#define ROLL_WK (1024)
64#define GPSWK_ROLL(W) (W-(int)W+(int)W%ROLL_WK)
65#define GPSWK_UNROLL(W) (W-(int)W+(int)W%ROLL_WK+(ROLL_NUMBER-((int)W%ROLL_WK>=GPSWK_LIMIT))*ROLL_WK)
66
67#define GPSEC_LIMIT (604800*GPSWK_LIMIT)
68#define ROLL_SEC (604800*ROLL_WK)
69#define GPSEC_ROLL(S) (S-(int)S+(int)S%ROLL_SEC)
70#define GPSEC_UNROLL(S) (S-(int)S+(int)S%ROLL_SEC+(ROLL_NUMBER-((int)S%ROLL_SEC>=GPSEC_LIMIT))*ROLL_SEC)
71
72#endif
Note: See TracBrowser for help on using the repository browser.