From: Harlan Stenn
-
-
- In static mode (the default) the driver assumes that the GPS antenna
is in a fixed location. The receiver is initially placed in a "Static,
-3D Nav" mode, where latitude, longitude, elevation and time are calculated
-for a fixed station. A DOP-weighted running average position is calculated
-from this data. After 24 hours, the receiver is placed into a "Known Position"
-mode, initialized with the calculated position, and then solves only for
-time.
+3D Nav" mode, where latitude, longitude, elevation and time are
+calculated for a fixed station. An average position is calculated from
+this data. After 24 hours, the receiver is placed into a "Known
+Position" mode, initialized with the calculated position, and then
+solves only for time.
In mobile mode, the driver assumes the GPS antenna is mounted on a moving
platform such as a car, ship, or aircraft. The receiver is placed in "Dynamic,
3D Nav" mode and solves for position, altitude and time while moving. No
position averaging is performed.
-
-Copyright Notice
-
+
+
"Clone
+Copyright Notice
+
+
"Clone
me," says Dolly sheepishly
@@ -59,6 +60,9 @@ kirkwood@striderfm.intel.com">Clayton Kirkwood
<greg.brackley@bigfoot.com> Major rework of WINNT port. Clean
up recvbuf and iosignal code into separate modules.
+
David L. Mills <mills@udel.edu>
-
+
+
+
+David L. Mills <mills@udel.edu>
+
+
+
diff --git a/html/driver9.htm b/html/driver9.htm
index 8a11a0216..def05f86c 100644
--- a/html/driver9.htm
+++ b/html/driver9.htm
@@ -2,24 +2,21 @@
-
-Magnavox MX4200 GPS Receiver
+Magnavox MX4200 GPS Receiver
-
-Synopsis
+Synopsis
Address: 127.127.9.u
Reference ID: GPS
Driver ID: GPS_MX4200
Serial Port: /dev/gpsu; 4800 baud, 8-bits, no parity
Features: ppsclock (required)
-
-Description
+
+Description
This driver supports the Magnavox MX4200 Navigation Receiver adapted to
precision timing applications. It requires the ppsclock line
discipline or streams module described in the Line
@@ -32,8 +29,9 @@ Interfacing page.
MX4200, MX4200D, and the 12-channel MX9212, MX9012R, MX9112.
+
+
Leica Geosystems acquired
the Magnavox commercial GPS technology business in February of 1994.
They now market and support former Magnavox GPS products such as the
@@ -44,32 +42,30 @@ Leica MX9400N Navigator.
-Operating Modes
+Operating Modes
This driver supports two modes of operation, static and mobile, controlled
by clock flag 2.
-Monitor Data
+
+Monitor Data
The driver writes each timecode as received to the clockstats
file. Documentation for the NMEA-0183 proprietary
sentences produced by the MX4200 can be found in
MX4200 Receiver Data Format.
-
-Fudge Factors
+Fudge Factors
MX4200 Receiver Data Format
@@ -10,23 +11,23 @@
@@ -38,8 +39,8 @@
the receiver. The structure of the control port sentences is based on
the NMEA-0183 Standard for Interfacing Marine Electronics
Navigation Devices (version 1.5). For more details, please refer to
-the NMEA-0183 Specification available from the National Marine Electronics
+the NMEA-0183 Specification available from the
+National Marine Electronics
Association.
-
-
-
Reserved characters are used to indicate the beginning and the end @@ -50,10 +51,7 @@ characters and defines their usage. Table 1 illustrates the general Magnavox proprietary NMEA sentence format.
-+
$PMVXG,XXX,...................*CK
@@ -135,16 +133,16 @@ Initializes the time, position and antenna height of the MX4200.
| Field | Description | Units | Format | Default | Range - |
|---|---|---|---|---|---|
| 1 | Day | Int | 1-31 - | ||
| 2 | Month | Int | 1-12 - | ||
| 3 | Year | Int | 1991-9999 - | ||
| 4 | GMT Time | HHMMSS | Int | 000000-235959 + | |
| 1 | Day |   | Int |   | 1-31 + |
| 2 | Month |   | Int |   | 1-12 + |
| 3 | Year |   | Int |   | 1991-9999 + |
| 4 | GMT Time | HHMMSS | Int |   | 000000-235959 |
| 5 | WGS-84 Latitude | DDMM.MMMM | Float | 0.0 | 0 - 8959.9999 - |
| 6 | North/South Indicator | Char | N | N,S + | |
| 6 | North/South Indicator |   | Char | N | N,S |
| 7 | WGS-84 Longitude | DDDMM.MMMM | Float | 0.0 | 0 - 17959.9999 - |
| 8 | East/West Indicator | Char | E | E,W + | |
| 8 | East/West Indicator |   | Char | E | E,W |
| 9 | Altitude (height above Mean Sea Level) in meters (WGS-84) | Meters | Float | 0.0 | +/-99999.0 - |
| 10 | Not Used | + | |||
| 10 | Not Used |   |   |   |   |
$PMVXG,000,,,,,,,,,,*48
| Field | Description | Units | Format | Default | Range - |
|---|---|---|---|---|---|
| *1 | Constrain Altitude | Int | 1 | 0=3D Only 1=Auto 2=2D Only - | |
| 2 | Not Used | + | |||
| *1 | Constrain Altitude |   | Int | 1 | 0=3D Only 1=Auto 2=2D Only + |
| 2 | Not Used |   |   |   |   |
| *3 | Horizontal Acceleration Factor | m/sec^2 | Float | 1.0 | 0.5-10.0 - |
| *4 | Not Used | - | |||
| *5 | VDOP Limit | Int | 10 | 1-9999 - | |
| *6 | HDOP Limit | Int | 10 | 1-9999 + | |
| *4 | Not Used |   |   |   |   + |
| *5 | VDOP Limit |   | Int | 10 | 1-9999 + |
| *6 | HDOP Limit |   | Int | 10 | 1-9999 |
| 7 | Elevation Limit | Deg | Int | 5 | 0-90 - |
| 8 | Time Output Mode | Char | U | U=UTC L=Local Time + | |
| 8 | Time Output Mode |   | Char | U | U=UTC L=Local Time |
| 9 | Local Time Offset | HHMM | Int | 0 | +/- 0-2359 |
| Field | Description | Units | Format | Default | Range - |
|---|---|---|---|---|---|
| 1 | Control Port Output Block Label | Char | - | ||
| 2 | Clear Current Output List | Int | 0=No 1=Yes - | ||
| 3 | Add/Delete Sentence from List | Int | 1=Append 2=Delete - | ||
| 4 | Not Used | - | |||
| 5 | Sentence Output Rate | Sec | Int | 1-9999 - | |
| 6 | # digits of Precision for CGA and GLL sentences | Int | 2 | 2-4 - | |
| 7 | Not Used | - | |||
| 8 | Not Used | + | |||
| 1 | Control Port Output Block Label |   | Char |   |   + |
| 2 | Clear Current Output List |   | Int |   | 0=No 1=Yes + |
| 3 | Add/Delete Sentence from List |   | Int |   | 1=Append 2=Delete + |
| 4 | Not Used |   |   |   |   + |
| 5 | Sentence Output Rate | Sec | Int |   | 1-9999 + |
| 6 | # digits of Precision for CGA and GLL sentences |   | Int | 2 | 2-4 + |
| 7 | Not Used |   |   |   |   + |
| 8 | Not Used |   |   |   |   |
$PMVXG,007,022,0,1,,1,,,*4F
@@ -212,13 +210,13 @@ unit.
| Field | Description | Units | Format | Default | Range - |
|---|---|---|---|---|---|
| *1 | Time Recovery Mode | Char | D | D=Dynamic S=Static K=Known Position N=No Time Recovery - | |
| 2 | Time Synchronization | Char | G | U=UTC G=GPS - | |
| 3 | Time Mark Mode | Char | A | A=Always V=Valid Pulses Only + | |
| *1 | Time Recovery Mode |   | Char | D | D=Dynamic S=Static K=Known Position N=No Time Recovery + |
| 2 | Time Synchronization |   | Char | G | U=UTC G=GPS + |
| 3 | Time Mark Mode |   | Char | A | A=Always V=Valid Pulses Only |
| 4 | Maximum Time Error | Nsec | Int | 100 | 50-1000 |
| 5 | User Time Bias | Nsec | Int | 0 | +/- 99999 - |
| 6 | ASCII Time Message Control | Int | 0 | 0=No Output 1=830 to Control Port 2=830 to Equipment Port - | |
| 7 | Known Pos PRN | Int | 0 | 1-32 0=Track All Sats + | |
| 6 | ASCII Time Message Control |   | Int | 0 | 0=No Output 1=830 to Control Port 2=830 to Equipment Port + |
| 7 | Known Pos PRN |   | Int | 0 | 1-32 0=Track All Sats |
$PMVXG,023,S,U,A,500,0,1,*16
@@ -235,10 +233,10 @@ sentence $PMVXG,007.
| Field | Description | Units | Format | Default | Range - |
|---|---|---|---|---|---|
| 1:CD | ID of Remote Device | Char | (See NMEA-0183) - | ||
| 2:GP | GPS | Char | (See NMEA-0183) - | ||
| 3:Q | Query | Char | (See NMEA-0183) - | ||
| 4:YYY | Label of Desired Sentence | Char | Any Valid NMEA or Magnavox Sentence Type + | ||
| 1:CD | ID of Remote Device |   | Char |   | (See NMEA-0183) + |
| 2:GP | GPS |   | Char |   | (See NMEA-0183) + |
| 3:Q | Query |   | Char |   | (See NMEA-0183) + |
| 4:YYY | Label of Desired Sentence |   | Char |   | Any Valid NMEA or Magnavox Sentence Type |
$CDGPQ,030*5E
@@ -261,11 +259,11 @@ tracked.
| Field | Description | Units | Format | Range - |
|---|---|---|---|---|
| 1 | Current Receiver Status | Char | ACQ=Reacquisition ALT=Constellation Selection IAC=Initial Acquisition IDL=Idle, No Satellites NAV=Navigating STS=Search The Sky TRK=Tracking - | |
| 2 | Number of Satellites that should be Visible | Int | 0-12 - | |
| 3 | Number of Satellites being Tracked | Int | 0-12 + | |
| 1 | Current Receiver Status |   | Char | ACQ=Reacquisition ALT=Constellation Selection IAC=Initial Acquisition IDL=Idle, No Satellites NAV=Navigating STS=Search The Sky TRK=Tracking + |
| 2 | Number of Satellites that should be Visible |   | Int | 0-12 + |
| 3 | Number of Satellites being Tracked |   | Int | 0-12 |
| 4 | Time since Last Navigation | HHMM | Int | 0-2359 - |
| 5 | Initialization Status | Int | 0=Waiting for Initialization 1=Initialization Complete + | |
| 5 | Initialization Status |   | Int | 0=Waiting for Initialization 1=Initialization Complete |
$PMVXG,000,TRK,3,3,0122,1*19
@@ -283,14 +281,14 @@ applications.
| Field | Description | Units | Format | Range |
|---|---|---|---|---|
| 1 | UTC Measurement Time | Seconds into the week | Float | 0-604800.00 - |
| 2 | East DOP (EDOP) | Float | - | |
| 3 | North DOP (NDOP) | Float | - | |
| 4 | Vertical DOP (VDOP) | Float | - | |
| 5 | PRN on Channel #1 | Int | 1-32 - | |
| 6 | PRN on Channel #2 | Int | 1-32 - | |
| 7 | PRN on Channel #3 | Int | 1-32 - | |
| 8 | PRN on Channel #4 | Int | 1-32 - | |
| 9 | PRN on Channel #5 | Int | 1-32 - | |
| 10 | PRN on Channel #6 | Int | 1-32 - | |
| 11 | PRN on Channel #7 | Int | 1-32 - | |
| 12 | PRN on Channel #8 | Int | 1-32 - | |
| 13 | PRN on Channel #9 | Int | 1-32 - | |
| 14 | PRN on Channel #10 | Int | 1-32 - | |
| 15 | PRN on Channel #11 | Int | 1-32 - | |
| 16 | PRN on Channel #12 | Int | 1-32 + | |
| 2 | East DOP (EDOP) |   | Float |   + |
| 3 | North DOP (NDOP) |   | Float |   + |
| 4 | Vertical DOP (VDOP) |   | Float |   + |
| 5 | PRN on Channel #1 |   | Int | 1-32 + |
| 6 | PRN on Channel #2 |   | Int | 1-32 + |
| 7 | PRN on Channel #3 |   | Int | 1-32 + |
| 8 | PRN on Channel #4 |   | Int | 1-32 + |
| 9 | PRN on Channel #5 |   | Int | 1-32 + |
| 10 | PRN on Channel #6 |   | Int | 1-32 + |
| 11 | PRN on Channel #7 |   | Int | 1-32 + |
| 12 | PRN on Channel #8 |   | Int | 1-32 + |
| 13 | PRN on Channel #9 |   | Int | 1-32 + |
| 14 | PRN on Channel #10 |   | Int | 1-32 + |
| 15 | PRN on Channel #11 |   | Int | 1-32 + |
| 16 | PRN on Channel #12 |   | Int | 1-32 |
$PMVXG,022,142243.00,00.7,00.8,01.9,27,26,10,09,13,23*77
@@ -350,8 +348,8 @@ version numbers.
| Field | Description | Units | Format | Range - |
|---|---|---|---|---|
| 1 | Nav Processor Version Number | Char | - | |
| 2 | Baseband Firmware Version Number | Char | + | |
| 1 | Nav Processor Version Number |   | Char |   + |
| 2 | Baseband Firmware Version Number |   | Char |   |
$PMVXG,030,DA35,015
@@ -367,16 +365,16 @@ received.
| Field | Description | Units | Format | Range - |
|---|---|---|---|---|
| 1 | Sentence ID | Char | - | |
| 2 | Accept/Reject Status | Int | 0=Sentence Accepted + | |
| 1 | Sentence ID |   | Char |   + |
| 2 | Accept/Reject Status |   | Int | 0=Sentence Accepted 1=Bad Checksum 2=Illegal Value 3=Unrecognized ID 4=Wrong # of fields 5=Required Data Field Missing 6=Requested Sentence Unavailable - |
| 3 | Bad Field Index | Int | - | |
| 4 | Requested Sentence ID (If field #1 = GPQ) | Char | + | |
| 3 | Bad Field Index |   | Int |   + |
| 4 | Requested Sentence ID (If field #1 = GPQ) |   | Char |   |
$PMVXG,101,GPQ,0,,030*0D
@@ -391,13 +389,13 @@ of the receiver.
| Field | Description | Units | Format | Range - |
|---|---|---|---|---|
| 1 | Time Recovery Mode | Char | D=Dynamic S=Static K=Known Position N=No Time Recovery - | |
| 2 | Time Synchronization | Char | U=UTC Time G=GPS Time - | |
| 3 | Time Mark Mode | Char | A=Always Output Time Pulse V=Only when Valid - | |
| 4 | Maximum Time Error for which a time mark will be considered valid | Nsec | Int | - |
| 5 | User Time Bias | Nsec | Int | - |
| 6 | Time Message Control | Int | 0=No Message 1=830 to Control Port 2=830 to Equipment Port - | |
| 7 | Not Used | + | ||
| 1 | Time Recovery Mode |   | Char | D=Dynamic S=Static K=Known Position N=No Time Recovery + |
| 2 | Time Synchronization |   | Char | U=UTC Time G=GPS Time + |
| 3 | Time Mark Mode |   | Char | A=Always Output Time Pulse V=Only when Valid + |
| 4 | Maximum Time Error for which a time mark will be considered valid | Nsec | Int |   + |
| 5 | User Time Bias | Nsec | Int |   + |
| 6 | Time Message Control |   | Int | 0=No Message 1=830 to Control Port 2=830 to Equipment Port + |
| 7 | Not Used |   |   |   |
$PMVXG,523,S,U,A,0500,000000,1,0*23
@@ -417,23 +415,23 @@ receivers.
| Field | Description | Units | Format | Range - | |||
|---|---|---|---|---|---|---|---|
| 1 | Time Mark Valid | Char | T=Valid F=Not Valid - | ||||
| 2 | Year | Int | 1993- - | ||||
| 3 | Month | Int | 1-12 + | ||||
| 1 | Time Mark Valid |   | Char | T=Valid F=Not Valid + | |||
| 2 | Year |   | Int | 1993- + | |||
| 3 | Month |   | Int | 1-12 | |||
| 4 | Day | Nsec | Int | 1-31 | |||
| 5 | Time | HH:MM:SS | Int | 00:00:00-23:59:59 - | |||
| 6 | Time Synchronization | Char | U=UTC G=GPS - | ||||
| 7 | Operating Mode | Char | D=Dynamic S=Static K=Known Position - | ||||
| 8 | Oscillator Offset - estimate of oscillator frequency error | PPB | Int | - | |||
| 9 | Time Mark Error of last pulse | Nsec | Int | - | |||
| 10 | User Time Bias | Nsec | Int | + | |||
| 6 | Time Synchronization |   | Char | U=UTC G=GPS + | |||
| 7 | Operating Mode |   | Char | D=Dynamic S=Static K=Known Position + | |||
| 8 | Oscillator Offset - estimate of oscillator frequency error | PPB | Int |   + | |||
| 9 | Time Mark Error of last pulse | Nsec | Int |   + | |||
| 10 | User Time Bias | Nsec | Int |   | |||
| 11 | Leap Second Flag - indicates that a leap second will occur. This value is usually zero except during the week prior to a leap second occurence, when this value will be set to +/-1. A value of +1 indicates that GPS time will be 1 second further ahead of UTC time. - | Int | -1,0,1 + |   | Int | -1,0,1 |
$PMVXG,830,T,1998,10,12,15:30:46,U,S,000298,00003,000000,01*02
diff --git a/ntpd/refclock_mx4200.c b/ntpd/refclock_mx4200.c
index f08bb2336..fe6369ef4 100644
--- a/ntpd/refclock_mx4200.c
+++ b/ntpd/refclock_mx4200.c
@@ -97,7 +97,7 @@ struct ppsclockev {
/*
* Check this every time you edit the code!
*/
-#define YEAR_RIGHT_NOW 1998
+#define YEAR_LAST_MODIFIED 2000
/*
* GPS Definitions
@@ -117,13 +117,6 @@ struct ppsclockev {
/*
* Position Averaging.
- * Reference: Dr. Thomas A. Clark's Totally Accurate Clock (TAC) files at
- * ftp://aleph.gsfc.nasa.gov/GPS/totally.accurate.clock/
- * For a 6-channel Motorola Oncore, he indicates that good nominal
- * HDOP and VDOP are 1.50 and 2.00 respectively. Given the relationship
- * HDOP^2 = NDOP^2 + EDOP^2 and assuming EDOP and NDOP are equal, we
- * have a nominal NDOP = EDOP = sqrt((HDOP*HDOP)/2). An 8-channel
- * Oncore does well with HDOP=1.20 and VDOP=1.70.
*/
#define INTERVAL 1 /* Interval between position measurements (s) */
#define AVGING_TIME 24 /* Number of hours to average */
@@ -141,12 +134,7 @@ struct mx4200unit {
double avg_lon; /* average longitude */
double avg_alt; /* average height */
double central_meridian; /* central meridian */
- double filt_lat; /* latitude filter length */
- double filt_lon; /* longitude filter length */
- double filt_alt; /* height filter length */
- double edop; /* EDOP (east DOP) */
- double ndop; /* NDOP (north DOP) */
- double vdop; /* VDOP (vertical DOP) */
+ double N_fixes; /* Number of position measurements */
int last_leap; /* leap second warning */
u_int moving; /* mobile platform? */
u_long sloppyclockflag; /* fudge flags */
@@ -181,7 +169,6 @@ static void mx4200_poll P((int, struct peer *));
static char * mx4200_parse_t P((struct peer *));
static char * mx4200_parse_p P((struct peer *));
-static char * mx4200_parse_d P((struct peer *));
static char * mx4200_parse_s P((struct peer *));
#ifdef QSORT_USES_VOID_P
int mx4200_cmpl_fp P((const void *, const void *));
@@ -324,12 +311,7 @@ mx4200_config(
up->avg_lon = 0.0;
up->avg_alt = 0.0;
up->central_meridian = NOT_INITIALIZED;
- up->filt_lat = 0.0;
- up->filt_lon = 0.0;
- up->filt_alt = 0.0;
- up->edop = 1;
- up->ndop = 1;
- up->vdop = 1;
+ up->N_fixes = 0.0;
up->last_leap = 0; /* LEAP_NOWARNING */
up->clamp_time = current_time + (AVGING_TIME * 60 * 60);
up->log_time = current_time + SLEEPTIME;
@@ -419,7 +401,7 @@ mx4200_config(
500, /* max time error in ns */
0, /* user bias in ns */
1); /* output "830" sentences to control port */
- /* Multi-satellite mode */
+ /* Multi-satellite mode */
/*
* Output position information (to calculate fixed installation
@@ -431,21 +413,6 @@ mx4200_config(
add_mode = 1; /* add to list */
}
- /*
- * "007" Control Port Configuration
- * Output "022" DOPs
- */
- mx4200_send(peer, "%s,%03d,%03d,%d,%d,,%d,,,", pmvxg,
- PMVXG_S_PORTCONF,
- PMVXG_D_DOPS, /* control port output block Label */
- 0, /* clear current output control list (0=no) */
- add_mode, /* add/delete sentences from list (1=add, 2=del) */
- /* must be null */
- INTERVAL); /* sentence output rate (sec) */
- /* precision for position output */
- /* nmea version for cga & gll output */
- /* pass-through control */
-
/*
* "007" Control Port Configuration
@@ -456,11 +423,11 @@ mx4200_config(
PMVXG_D_PHV, /* control port output block Label */
0, /* clear current output control list (0=no) */
add_mode, /* add/delete sentences from list (1=add, 2=del) */
- /* must be null */
+ /* must be null */
INTERVAL); /* sentence output rate (sec) */
- /* precision for position output */
- /* nmea version for cga & gll output */
- /* pass-through control */
+ /* precision for position output */
+ /* nmea version for cga & gll output */
+ /* pass-through control */
}
/*
@@ -488,21 +455,6 @@ mx4200_ref(
*/
up->log_time = current_time + SLEEPTIME;
- /*
- * "007" Control Port Configuration
- * Stop outputting "022" DOPs
- */
- mx4200_send(peer, "%s,%03d,%03d,%d,%d,,,,,", pmvxg,
- PMVXG_S_PORTCONF,
- PMVXG_D_DOPS, /* control port output block Label */
- 0, /* clear current output control list (0=no) */
- 2); /* add/delete sentences from list (2=delete) */
- /* must be null */
- /* sentence output rate (sec) */
- /* precision for position output */
- /* nmea version for cga & gll output */
- /* pass-through control */
-
/*
* "007" Control Port Configuration
* Stop outputting "021" position, height, velocity reports
@@ -801,14 +753,8 @@ mx4200_receive(
return;
}
mx4200_debug(peer,
- "mx4200_receive: position avg %.9f %.9f %.4f\n",
- up->avg_lat, up->avg_lon, up->avg_alt);
- mx4200_debug(peer,
- "mx4200_receive: position len %.4f %.4f %.4f\n",
- up->filt_lat, up->filt_lon, up->filt_alt);
- mx4200_debug(peer,
- "mx4200_receive: position dop %.1f %.1f %.1f\n",
- up->ndop, up->edop, up->vdop);
+ "mx4200_receive: position avg %f %.9f %.9f %.4f\n",
+ up->N_fixes, up->avg_lat, up->avg_lon, up->avg_alt);
/*
* Reinitialize as a reference station
* if position is well known.
@@ -821,17 +767,6 @@ mx4200_receive(
return;
}
- /*
- * "022" DOPs, if we are still averaging our position
- */
- if (sentence_type == PMVXG_D_DOPS && !up->known) {
- if ((cp = mx4200_parse_d(peer)) != NULL) {
- mx4200_debug(peer, "mx4200_receive: dop: %s\n", cp);
- return;
- }
- return;
- }
-
/*
* Print to the syslog:
* "004" Mode Data
@@ -1029,7 +964,7 @@ mx4200_parse_t(
* (Certainly can't be any year before this code was last altered!)
*/
if (day_of_month > 31 || month > 12 ||
- day_of_month < 1 || month < 1 || year < YEAR_RIGHT_NOW) {
+ day_of_month < 1 || month < 1 || year < YEAR_LAST_MODIFIED) {
mx4200_debug(peer,
"mx4200_parse_t: bad date (%4d-%02d-%02d)\n",
year, month, day_of_month);
@@ -1250,7 +1185,7 @@ mx4200_parse_p(
struct refclockproc *pp;
struct mx4200unit *up;
int sentence_type, mode;
- double mtime, lat, lon, alt, geoid, vele, veln, weight;
+ double mtime, lat, lon, alt, geoid, vele, veln;
char north_south, east_west;
pp = peer->procptr;
@@ -1324,92 +1259,22 @@ mx4200_parse_p(
if (lon > 180.0) lon -= 360.0;
/*
- * Calculate running weighted averages
+ * Calculate running averages
*/
- weight = 1. / up->edop;
- weight *= weight;
- up->avg_lon = (up->filt_lon * up->avg_lon) + (weight * lon);
- up->filt_lon += weight;
- up->avg_lon = up->avg_lon / up->filt_lon;
-
- weight = 1. / up->ndop;
- weight *= weight;
- up->avg_lat = (up->filt_lat * up->avg_lat) + (weight * lat);
- up->filt_lat += weight;
- up->avg_lat = up->avg_lat / up->filt_lat;
-
- weight = 1. / up->vdop;
- weight *= weight;
- up->avg_alt = (up->filt_alt * up->avg_alt) + (weight * alt);
- up->filt_alt += weight;
- up->avg_alt = up->avg_alt / up->filt_alt;
- mx4200_debug(peer,
- "mx4200_receive: position rdg %.9f %.9f %.4f (CM=%.9f)\n",
- lat, lon, alt, up->central_meridian);
+ up->avg_lon = (up->N_fixes * up->avg_lon) + lon;
+ up->avg_lat = (up->N_fixes * up->avg_lat) + lat;
+ up->avg_alt = (up->N_fixes * up->avg_alt) + alt;
- return (NULL);
-}
+ up->N_fixes += 1.0;
-/*
- * Parse a mx4200 DOP sentence.
- *
- * A typical message looks like this. Checksum has already been stripped.
- *
- * $PMVXG,022,SSSSSS.SSEE.E,NN.N,VV.V,XX,XX,XX,XX,XX,XX
- *
- * Field Field Contents
- * ----- --------------
- * Block Label: $PMVXG
- * Sentence Type: 022=DOPs. The DOP values in this sentence
- * correspond to the satellites listed. The PRNs in
- * the message are listed in receiver channel number order
- * 1 UTC measurement time (seconds into week)
- * 2 EDOP (east DOP)
- * 3 NDOP (north DOP)
- * 4 VDOP (vertical DOP)
- * 5 PRN on channel 1
- * 6 PRN on channel 2
- * 7 PRN on channel 3
- * 8 PRN on channel 4
- * 9 PRN on channel 5
- * 10 PRN on channel 6
- * 11 PRN on channel 7 (12-channel receivers only)
- * 12 PRN on channel 8 (12-channel receivers only)
- * 13 PRN on channel 9 (12-channel receivers only)
- * 14 PRN on channel 10 (12-channel receivers only)
- * 15 PRN on channel 11 (12-channel receivers only)
- * 16 PRN on channel 12 (12-channel receivers only)
- */
-static char *
-mx4200_parse_d(
- struct peer *peer
- )
-{
- struct refclockproc *pp;
- struct mx4200unit *up;
- int sentence_type;
- double mtime, edop, ndop, vdop;
+ up->avg_lon /= up->N_fixes;
+ up->avg_lat /= up->N_fixes;
+ up->avg_alt /= up->N_fixes;
- pp = peer->procptr;
- up = (struct mx4200unit *)pp->unitptr;
-
- /* Should never happen! */
- if (up->moving) return ("mobile platform - no dop!");
-
- sscanf ( pp->a_lastcode, "$PMVXG,%d,%lf,%lf,%lf,%lf",
- &sentence_type, &mtime, &edop, &ndop, &vdop);
-
- /* Sentence type */
- if (sentence_type != PMVXG_D_DOPS)
- return ("wrong rec-type");
-
- /* Update values */
- if (edop <= 0.0 || ndop <= 0.0 || vdop <= 0.0)
- return ("nonpositive dop");
- up->edop = edop;
- up->ndop = ndop;
- up->vdop = vdop;
+ mx4200_debug(peer,
+ "mx4200_receive: position rdg %.0f: %.9f %.9f %.4f (CM=%.9f)\n",
+ up->N_fixes, lat, lon, alt, up->central_meridian);
return (NULL);
}