From 0e8d0f6367a25c773021b9b3a73b7ce8cb953af7 Mon Sep 17 00:00:00 2001 From: Christian Gagneraud Date: Tue, 5 Jun 2012 14:08:19 +0100 Subject: [AIS] Met/Hydro: fixes and improvements --- ais_json.c | 2 +- driver_ais.c | 23 +++++++---------- gps.h | 12 +++++---- gpsd_json.c | 56 ++++++++++++++++++---------------------- gpsdecode.c | 41 +++++++++++++++++++++++++++++ jsongen.py.in | 68 ++++++++++++++++++++++++++----------------------- test/sample.aivdm | 59 +++++++++++++++++++++++++++++++++++++++--- test/sample.aivdm.chk | 1 + test/synthetic-ais.json | 1 + www/AIVDM.txt | 46 +++++++++++++++++---------------- 10 files changed, 200 insertions(+), 109 deletions(-) diff --git a/ais_json.c b/ais_json.c index 7bc50daa..f7a69665 100644 --- a/ais_json.c +++ b/ais_json.c @@ -313,7 +313,7 @@ int json_ais_read(const char *buf, ais->type8.dac1fid31.hour = AIS_HOUR_NOT_AVAILABLE; ais->type8.dac1fid31.minute = AIS_MINUTE_NOT_AVAILABLE; // cppcheck-suppress uninitvar - (void)sscanf(eta, "%02uT%02u:%02uZ", + (void)sscanf(timestamp, "%02uT%02u:%02uZ", &ais->type8.dac1fid31.day, &ais->type8.dac1fid31.hour, &ais->type8.dac1fid31.minute); diff --git a/driver_ais.c b/driver_ais.c index 68e8e698..992063a3 100644 --- a/driver_ais.c +++ b/driver_ais.c @@ -10,6 +10,7 @@ * For the special IMO messages (types 6 and 8), only the following have been * tested against known-good decodings: * - IMO236 met/hydro message: Type=8, DAC=1, FI=11 + * - IMO289 met/hydro message: Type=8, DAC=1, FI=31 * * This file is Copyright (c) 2010 by the GPSD project * BSD terms apply: see the file COPYING in the distribution root for details. @@ -31,11 +32,8 @@ #define DAC1FID11_LEVEL_OFFSET 100 #define DAC1FID11_WATERTEMP_OFFSET 100 -#define DAC1FID31_AIRTEMP_OFFSET 600 -#define DAC1FID31_DEWPOINT_OFFSET 200 -#define DAC1FID31_PRESSURE_OFFSET -800 -#define DAC1FID31_LEVEL_OFFSET 100 -#define DAC1FID31_WATERTEMP_OFFSET 100 +#define DAC1FID31_PRESSURE_OFFSET -799 +#define DAC1FID31_LEVEL_OFFSET 1000 static void from_sixbit(char *bitvec, uint start, int count, char *to) { @@ -543,8 +541,8 @@ bool ais_binary_decode(struct ais_t *ais, ais->type8.dac1fid29.text); break; case 31: /* IMO289 - Meteorological/Hydrological data */ - ais->type8.dac1fid31.lat = SBITS(56, 24); - ais->type8.dac1fid31.lon = SBITS(80, 25); + ais->type8.dac1fid31.lon = SBITS(56, 25); + ais->type8.dac1fid31.lat = SBITS(81, 24); ais->type8.dac1fid31.accuracy = (bool)UBITS(105, 1); ais->type8.dac1fid31.day = UBITS(106, 5); ais->type8.dac1fid31.hour = UBITS(111, 5); @@ -553,17 +551,15 @@ bool ais_binary_decode(struct ais_t *ais, ais->type8.dac1fid31.wgust = UBITS(129, 7); ais->type8.dac1fid31.wdir = UBITS(136, 9); ais->type8.dac1fid31.wgustdir = UBITS(145, 9); - ais->type8.dac1fid31.airtemp = SBITS(154, 11) - - DAC1FID31_AIRTEMP_OFFSET; + ais->type8.dac1fid31.airtemp = SBITS(154, 11); ais->type8.dac1fid31.humidity = UBITS(165, 7); - ais->type8.dac1fid31.dewpoint = UBITS(172, 10) - - DAC1FID31_DEWPOINT_OFFSET; + ais->type8.dac1fid31.dewpoint = SBITS(172, 10); ais->type8.dac1fid31.pressure = UBITS(182, 9) - DAC1FID31_PRESSURE_OFFSET; ais->type8.dac1fid31.pressuretend = UBITS(191, 2); ais->type8.dac1fid31.visgreater = UBITS(193, 1); ais->type8.dac1fid31.visibility = UBITS(194, 7); - ais->type8.dac1fid31.waterlevel = UBITS(200, 12) + ais->type8.dac1fid31.waterlevel = UBITS(201, 12) - DAC1FID31_LEVEL_OFFSET; ais->type8.dac1fid31.leveltrend = UBITS(213, 2); ais->type8.dac1fid31.cspeed = UBITS(215, 8); @@ -581,8 +577,7 @@ bool ais_binary_decode(struct ais_t *ais, ais->type8.dac1fid31.swellperiod = UBITS(307, 6); ais->type8.dac1fid31.swelldir = UBITS(313, 9); ais->type8.dac1fid31.seastate = UBITS(322, 4); - ais->type8.dac1fid31.watertemp = UBITS(326, 10) - - DAC1FID31_WATERTEMP_OFFSET; + ais->type8.dac1fid31.watertemp = SBITS(326, 10); ais->type8.dac1fid31.preciptype = UBITS(336, 3); ais->type8.dac1fid31.salinity = UBITS(339, 9); ais->type8.dac1fid31.ice = UBITS(348, 2); diff --git a/gps.h b/gps.h index 0f4d69e4..09439ff3 100644 --- a/gps.h +++ b/gps.h @@ -1269,7 +1269,7 @@ struct ais_t unsigned int wgustdir; /* wind gust direction */ #define DAC1FID31_DIR_NOT_AVAILABLE 360 int airtemp; /* temperature, units 0.1C */ -#define DAC1FID31_AIRTEMP_NOT_AVAILABLE -1084 +#define DAC1FID31_AIRTEMP_NOT_AVAILABLE -1024 unsigned int humidity; /* relative humidity, % */ #define DAC1FID31_HUMIDITY_NOT_AVAILABLE 101 int dewpoint; /* dew point, units 0.1C */ @@ -1278,12 +1278,12 @@ struct ais_t #define DAC1FID31_PRESSURE_NOT_AVAILABLE 511 #define DAC1FID31_PRESSURE_HIGH 402 unsigned int pressuretend; /* tendency */ -#define DAC1FID31_PRESSURETREND_NOT_AVAILABLE 3 +#define DAC1FID31_PRESSURETEND_NOT_AVAILABLE 3 bool visgreater; /* visibility greater than */ unsigned int visibility; /* units 0.1 nautical miles */ #define DAC1FID31_VISIBILITY_NOT_AVAILABLE 127 int waterlevel; /* decimeters or cm */ -#define DAC1FID31_WATERLEVEL_NOT_AVAILABLE 40001 +#define DAC1FID31_WATERLEVEL_NOT_AVAILABLE 4001 unsigned int leveltrend; /* water level trend code */ #define DAC1FID31_LEVELTREND_NOT_AVAILABLE 3 unsigned int cspeed; /* current speed in deciknots */ @@ -1307,11 +1307,13 @@ struct ais_t unsigned int seastate; /* Beaufort scale, 0-12 */ #define DAC1FID31_SEASTATE_NOT_AVAILABLE 15 int watertemp; /* units 0.1deg Celsius */ -#define DAC1FID31_PRECIPTYPE_NOT_AVAILABLE 7 +#define DAC1FID31_WATERTEMP_NOT_AVAILABLE 601 unsigned int preciptype; /* 0-7, enumerated */ +#define DAC1FID31_PRECIPTYPE_NOT_AVAILABLE 7 unsigned int salinity; /* units of 0.1% */ #define DAC1FID31_SALINITY_NOT_AVAILABLE 510 - bool ice; /* is there sea ice? */ + unsigned int ice; /* is there sea ice? */ +#define DAC1FID31_ICE_NOT_AVAILABLE 3 } dac1fid31; }; } type8; diff --git a/gpsd_json.c b/gpsd_json.c index 39a64e6f..cdbc13a2 100644 --- a/gpsd_json.c +++ b/gpsd_json.c @@ -2122,6 +2122,23 @@ void json_aivdm_dump(const struct ais_t *ais, "decreasing", "N/A", }; + // WMO 306, Code table 4.201 + const char *preciptypes[] = { + "reserved", + "rain", + "thunderstorm", + "freezing rain", + "mixed/ice", + "snow", + "reserved", + "N/A", + }; + const char *ice[] = { + "no", + "yes", + "reserved", + "N/A", + }; switch (ais->type8.fid) { case 11: /* IMO236 - Meteorological/Hydrological data */ /* some fields have been merged to an ISO8601 partial date */ @@ -2183,21 +2200,6 @@ void json_aivdm_dump(const struct ais_t *ais, ais->type8.dac1fid11.waterlevel * 0.1); if (scaled) { - const char *preciptypes[] = { - "rain", - "thunderstorm", - "freezing rain", - "mixed/ice", - "snow", - "reserved", - "reserved", - "N/A", - }; - const char *ice[] = { - "no", - "yes", - "N/A", - }; (void)snprintf(buf + strlen(buf), buflen - strlen(buf), "\"leveltrend\":\"%s\"," "\"cspeed\":%.1f,\"cdir\":%u," @@ -2450,11 +2452,13 @@ void json_aivdm_dump(const struct ais_t *ais, if (scaled) (void)snprintf(buf + strlen(buf), buflen - strlen(buf), "\"airtemp\":%1f,\"dewpoint\":%1f," - "\"pressure\":%u,\"pressuretend\":\"%s\",", + "\"pressure\":%u,\"pressuretend\":\"%s\"," + "\"visgreater\":%s,", ais->type8.dac1fid31.airtemp * 0.1, ais->type8.dac1fid31.dewpoint * 0.1, ais->type8.dac1fid31.pressure, - trends[ais->type8.dac1fid31.pressuretend]); + trends[ais->type8.dac1fid31.pressuretend], + JSON_BOOL(ais->type8.dac1fid31.visgreater)); else (void)snprintf(buf + strlen(buf), buflen - strlen(buf), "\"airtemp\":%d,\"dewpoint\":%d," @@ -2484,16 +2488,6 @@ void json_aivdm_dump(const struct ais_t *ais, ais->type8.dac1fid31.waterlevel * 0.01); if (scaled) { - const char *preciptypes[] = { - "rain", - "thunderstorm", - "freezing rain", - "mixed/ice", - "snow", - "reserved", - "reserved", - "N/A", - }; (void)snprintf(buf + strlen(buf), buflen - strlen(buf), "\"leveltrend\":\"%s\"," "\"cspeed\":%.1f,\"cdir\":%u," @@ -2502,7 +2496,7 @@ void json_aivdm_dump(const struct ais_t *ais, "\"waveheight\":%.1f,\"waveperiod\":%u,\"wavedir\":%u," "\"swellheight\":%.1f,\"swellperiod\":%u,\"swelldir\":%u," "\"seastate\":%u,\"watertemp\":%.1f," - "\"preciptype\":%s,\"salinity\":%.1f,\"ice\":%s", + "\"preciptype\":\"%s\",\"salinity\":%.1f,\"ice\":\"%s\"", trends[ais->type8.dac1fid31.leveltrend], ais->type8.dac1fid31.cspeed * 0.1, ais->type8.dac1fid31.cdir, @@ -2522,7 +2516,7 @@ void json_aivdm_dump(const struct ais_t *ais, ais->type8.dac1fid31.watertemp * 0.1, preciptypes[ais->type8.dac1fid31.preciptype], ais->type8.dac1fid31.salinity * 0.1, - JSON_BOOL(ais->type8.dac1fid31.ice)); + ice[ais->type8.dac1fid31.ice]); } else (void)snprintf(buf + strlen(buf), buflen - strlen(buf), "\"leveltrend\":%u," @@ -2532,7 +2526,7 @@ void json_aivdm_dump(const struct ais_t *ais, "\"waveheight\":%u,\"waveperiod\":%u,\"wavedir\":%u," "\"swellheight\":%u,\"swellperiod\":%u,\"swelldir\":%u," "\"seastate\":%u,\"watertemp\":%d," - "\"preciptype\":%u,\"salinity\":%u,\"ice\":%s", + "\"preciptype\":%u,\"salinity\":%u,\"ice\":%u", ais->type8.dac1fid31.leveltrend, ais->type8.dac1fid31.cspeed, ais->type8.dac1fid31.cdir, @@ -2552,7 +2546,7 @@ void json_aivdm_dump(const struct ais_t *ais, ais->type8.dac1fid31.watertemp, ais->type8.dac1fid31.preciptype, ais->type8.dac1fid31.salinity, - JSON_BOOL(ais->type8.dac1fid31.ice)); + ais->type8.dac1fid31.ice); (void)strlcat(buf, "}\r\n", buflen); imo = true; break; diff --git a/gpsdecode.c b/gpsdecode.c index c510cc66..0198a66c 100644 --- a/gpsdecode.c +++ b/gpsdecode.c @@ -194,6 +194,47 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen) ais->type8.dac1fid11.ice); imo = true; break; + case 31: /* IMO289 - Met/Hydro message */ + (void)snprintf(buf + strlen(buf), buflen - strlen(buf), + "|%d|%d|%02uT%02u:%02uZ|%u|%u|%u|%u|%d|%u|%d|%u|%u|%u|%d|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%d|%u|%u|%u", + ais->type8.dac1fid31.lon, + ais->type8.dac1fid31.lat, + ais->type8.dac1fid31.day, + ais->type8.dac1fid31.hour, + ais->type8.dac1fid31.minute, + ais->type8.dac1fid31.wspeed, + ais->type8.dac1fid31.wgust, + ais->type8.dac1fid31.wdir, + ais->type8.dac1fid31.wgustdir, + ais->type8.dac1fid31.airtemp, + ais->type8.dac1fid31.humidity, + ais->type8.dac1fid31.dewpoint, + ais->type8.dac1fid31.pressure, + ais->type8.dac1fid31.pressuretend, + ais->type8.dac1fid31.visibility, + ais->type8.dac1fid31.waterlevel, + ais->type8.dac1fid31.leveltrend, + ais->type8.dac1fid31.cspeed, + ais->type8.dac1fid31.cdir, + ais->type8.dac1fid31.cspeed2, + ais->type8.dac1fid31.cdir2, + ais->type8.dac1fid31.cdepth2, + ais->type8.dac1fid31.cspeed3, + ais->type8.dac1fid31.cdir3, + ais->type8.dac1fid31.cdepth3, + ais->type8.dac1fid31.waveheight, + ais->type8.dac1fid31.waveperiod, + ais->type8.dac1fid31.wavedir, + ais->type8.dac1fid31.swellheight, + ais->type8.dac1fid31.swellperiod, + ais->type8.dac1fid31.swelldir, + ais->type8.dac1fid31.seastate, + ais->type8.dac1fid31.watertemp, + ais->type8.dac1fid31.preciptype, + ais->type8.dac1fid31.salinity, + ais->type8.dac1fid31.ice); + imo = true; + break; } break; } diff --git a/jsongen.py.in b/jsongen.py.in index 64751ff2..7c85b3c5 100644 --- a/jsongen.py.in +++ b/jsongen.py.in @@ -439,38 +439,42 @@ ais_specs = ( "structname": "ais->type8.dac1fid31", "fieldmap":( # fieldname type default - ('lon', 'integer', 'DAC1FID31_LON_NOT_AVAILABLE'), - ('lat', 'integer', 'DAC1FID31_LAT_NOT_AVAILABLE'), - ('accuracy', 'boolean', 'false'), - ('wspeed', 'uinteger', 'DAC1FID31_WIND_NOT_AVAILABLE'), - ('wgust ', 'uinteger', 'DAC1FID31_WIND_NOT_AVAILABLE'), - ('wdir', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), - ('wgustdir', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), - ('airtemp', 'integer', 'DAC1FID31_AIRTEMP_NOT_AVAILABLE'), - ('pressure', 'uinteger', 'DAC1FID31_PRESSURE_NOT_AVAILABLE'), - ('pressuretend', 'uinteger', 'DAC1FID31_PRESSURETREND_NOT_AVAILABLE'), - ('visibility', 'uinteger', 'DAC1FID31_VISIBILITY_NOT_AVAILABLE'), - ('visgreater', 'boolean', 'false'), - ('waterlevel', 'integer', 'DAC1FID31_WATERLEVEL_NOT_AVAILABLE'), - ('leveltrend', 'uinteger', 'DAC1FID31_LEVELTREND_NOT_AVAILABLE'), - ('cspeed', 'uinteger', 'DAC1FID31_CSPEED_NOT_AVAILABLE'), - ('cdir', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), - ('cspeed2', 'uinteger', 'DAC1FID31_CSPEED_NOT_AVAILABLE'), - ('cdir2', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), - ('cdepth2', 'uinteger', 'DAC1FID31_CDEPTH_NOT_AVAILABLE'), - ('cspeed3', 'uinteger', 'DAC1FID31_CSPEED_NOT_AVAILABLE'), - ('cdir3', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), - ('cdepth3', 'uinteger', 'DAC1FID31_CDEPTH_NOT_AVAILABLE'), - ('waveheight', 'uinteger', 'DAC1FID31_HEIGHT_NOT_AVAILABLE'), - ('waveperiod', 'uinteger', 'DAC1FID31_PERIOD_NOT_AVAILABLE'), - ('wavedir', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), - ('swellheight', 'uinteger', 'DAC1FID31_HEIGHT_NOT_AVAILABLE'), - ('swellperiod', 'uinteger', 'DAC1FID31_PERIOD_NOT_AVAILABLE'), - ('swelldir', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), - ('seastate', 'uinteger', 'DAC1FID31_SEASTATE_NOT_AVAILABLE'), - ('preciptype', 'uinteger', 'DAC1FID31_PRECIPTYPE_NOT_AVAILABLE'), - ('salinity', 'uinteger', 'DAC1FID31_SALINITY_NOT_AVAILABLE'), - ('ice', 'boolean', 'false'), + ('lon', 'integer', 'DAC1FID31_LON_NOT_AVAILABLE'), + ('lat', 'integer', 'DAC1FID31_LAT_NOT_AVAILABLE'), + ('accuracy', 'boolean', 'false'), + ('timestamp', 'string', None), + ('wspeed', 'uinteger', 'DAC1FID31_WIND_NOT_AVAILABLE'), + ('wgust', 'uinteger', 'DAC1FID31_WIND_NOT_AVAILABLE'), + ('wdir', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), + ('wgustdir', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), + ('airtemp', 'integer', 'DAC1FID31_AIRTEMP_NOT_AVAILABLE'), + ('humidity', 'uinteger', 'DAC1FID31_HUMIDITY_NOT_AVAILABLE'), + ('dewpoint', 'integer', 'DAC1FID31_DEWPOINT_NOT_AVAILABLE'), + ('pressure', 'uinteger', 'DAC1FID31_PRESSURE_NOT_AVAILABLE'), + ('pressuretend', 'uinteger', 'DAC1FID31_PRESSURETEND_NOT_AVAILABLE'), + ('visgreater', 'boolean', 'false'), + ('visibility', 'uinteger', 'DAC1FID31_VISIBILITY_NOT_AVAILABLE'), + ('waterlevel', 'uinteger', 'DAC1FID31_WATERLEVEL_NOT_AVAILABLE'), + ('leveltrend', 'uinteger', 'DAC1FID31_LEVELTREND_NOT_AVAILABLE'), + ('cspeed', 'uinteger', 'DAC1FID31_CSPEED_NOT_AVAILABLE'), + ('cdir', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), + ('cspeed2', 'uinteger', 'DAC1FID31_CSPEED_NOT_AVAILABLE'), + ('cdir2', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), + ('cdepth2', 'uinteger', 'DAC1FID31_CDEPTH_NOT_AVAILABLE'), + ('cspeed3', 'uinteger', 'DAC1FID31_CSPEED_NOT_AVAILABLE'), + ('cdir3', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), + ('cdepth3', 'uinteger', 'DAC1FID31_CDEPTH_NOT_AVAILABLE'), + ('waveheight', 'uinteger', 'DAC1FID31_HEIGHT_NOT_AVAILABLE'), + ('waveperiod', 'uinteger', 'DAC1FID31_PERIOD_NOT_AVAILABLE'), + ('wavedir', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), + ('swellheight', 'uinteger', 'DAC1FID31_HEIGHT_NOT_AVAILABLE'), + ('swellperiod', 'uinteger', 'DAC1FID31_PERIOD_NOT_AVAILABLE'), + ('swelldir', 'uinteger', 'DAC1FID31_DIR_NOT_AVAILABLE'), + ('seastate', 'uinteger', 'DAC1FID31_SEASTATE_NOT_AVAILABLE'), + ('watertemp', 'integer', 'DAC1FID31_WATERTEMP_NOT_AVAILABLE'), + ('preciptype', 'uinteger', 'DAC1FID31_PRECIPTYPE_NOT_AVAILABLE'), + ('salinity', 'uinteger', 'DAC1FID31_SALINITY_NOT_AVAILABLE'), + ('ice', 'uinteger', 'DAC1FID31_ICE_NOT_AVAILABLE'), ), "stringbuffered":("timestamp",), }, diff --git a/test/sample.aivdm b/test/sample.aivdm index fc9bed6f..a12dc169 100644 --- a/test/sample.aivdm +++ b/test/sample.aivdm @@ -266,7 +266,7 @@ # scaled parameter value, and CS the checksum). The resulting AIVDO # sentence has been decoded using the Kanaton software. Sent data, # kanaton decoder output and gpsd JSON output all match each other. -# +!AIVDO,1,1,4,B,8>jR06@0Bk3:wOli;<`WPhh<1rqVBQf2V@Pdt0J82avIM2b<jR06@0Bk3:wOli;<`WPhh<1rqVBQf2V@Pdt0J82avIM2b<jR06@0Bk3:wOli;<`WPhh<1rqVBQf2V@Pdt0J82avIM2b<jR06@0Bk3:vOli;L`nwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwt1,2*0E # "18/05/2012 18:45:37" !AIVDO,1,1,4,B,8>jR06@0Bk3:vOli;L`nwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwt1,2*0E # AIS channel:1 # Message ID=8 @@ -363,7 +364,57 @@ # Precipitation=0x7(7 according to WMO) # Salinity=0x1FF(51.1 permil) # Ice=0x3(3) -!AIVDO,1,1,4,B,8>jR06@0Bk3:vOli;L`nwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwt1,2*0E +# +# Type 8, DAC 1, FID 31 (IMO 289 Met/Hydro message) +# From Christian Gagneraud: +# Kanaton3 with all data marked as not available, checked with KanAton3_configV2.0.4.exe +!AIVDO,1,1,5,A,8>jR06@0Gwli:QQUP3en?wvlFR06EuOwgwl?wnSwe7wvlOwwsAwwnSGmwvh0,0*51 +# AIS channel:1 +# Message ID=8 +# Repeat Indicator=0 +# Source ID (MMSI)=992509977 +# Spare=0 +# Binary Data +# Application identifier=0x005F(95) +# DAC=1(International) +# Function identifier =31(Reserved for international operational applications) +# Application data: +# Longitude=0x59DAC(006°008.044 W) +# Latitude=0x30CB00(53°017.696 N) +# Pos. acc.=0 +# Date and time=0xEDD8(29 23h24m) +# Average wind speed=0x7F(127 kts) +# Wind gust=0x7F(127 kt(s)) +# Wind direction=0x168(360 degree(s)) +# Wind gust direction=0x168(360 degree(s)) +# Air temperature=0xFFFFFC00(-102.4 degree(s) Celcius) +# Relative humidity=0x65(101percent) +# Dew point=0x1F5(50.1 degree(s) Celcius) +# Air pressure=0x1FF(1310 hPa) +# Air pressure tendency=0x3(3(Not available)) +# Horizontal visibility=0x7F(12.7 NM) +# Water level=0xFA1(30.01 m) +# Water level trend=0x3(3) +# Surface current speed=0xFF(25.5 kts) +# Surface current direction=0x168(360 degree(s)) +# Current speed #2=0xFF(25.5 kts) +# Current direction #2=0x168(360 degree(s)) +# Current measuring level #2=0x1F(31 m) +# Current speed #3=0xFF(25.5 kts) +# Current direction #3=0x168(360 degree(s)) +# Current measuring level #3=0x1F(31 m) +# Significant wave height=0xFF(25.5 m) +# Wave period=0x3F(63 Sec) +# Wave direction=168(360 degree(s)) +# Swell height=0xFF(25.5) m +# Swell period=0x3F(63 Sec) +# Swell direction=0x168(360 degree(s)) +# Sea state=0xD(13 Beaufort) +# Water temperature=0x1F5(50.1 degree(s) Celcius) +# Precipitation=0x7(7 according to WMO) +# Salinity=0x1FE(51.0 permil) +# Ice=0x3(3) +# # Type 9: # From AISHub. Checked with the noaadata tools. !AIVDM,1,1,,A,91b77=h3h00nHt0Q3r@@07000<0b,0*69 diff --git a/test/sample.aivdm.chk b/test/sample.aivdm.chk index 3a0fd493..6b6adfd8 100644 --- a/test/sample.aivdm.chk +++ b/test/sample.aivdm.chk @@ -14,6 +14,7 @@ 8|0|999999999|366|56|256:eb0d4f917a035b2dfca3d4739381735c18ebbe754936f66850037dcacd9538b8 8|0|992509977|1|11|-368039|3197693|18T17:15Z|3|6|12|15|142|50|123|1024|2|153|-84|1|103|256|104|257|10|126|203|20|42|35|25|23|48|124|3|123|6|53|0 8|0|992509977|1|11|-368037|3197689|18T17:45Z|127|127|511|511|1447|127|823|1311|3|255|411|3|255|511|255|511|31|255|511|31|255|63|511|255|63|511|15|923|7|511|3 +8|0|992509977|1|31|-368044|3197696|29T23:24Z|127|127|360|360|-1024|101|501|1310|3|127|3001|3|255|360|255|360|31|255|360|31|255|63|360|255|63|360|13|501|7|510|3 9|0|111265591|15|0|0|7128960|34667073|0|28|0x0|0|0|0x6015 10|0|366814480|366832740 10|0|440882000|366972000 diff --git a/test/synthetic-ais.json b/test/synthetic-ais.json index 4d9e77fc..3622a2a6 100644 --- a/test/synthetic-ais.json +++ b/test/synthetic-ais.json @@ -21,6 +21,7 @@ {"class":"AIS","type":8,"repeat":0,"mmsi":366999655,"scaled":false,"dac":366,"fid":22,"data":"256:631d1d6b32f735f03494870d9e13addaf3f373435347ab94628f1498868051c3"} {"class":"AIS","type":8,"repeat":0,"mmsi":992509977,"scaled":false,"dac":1,"fid":11,"lat":3197693,"lon":-368039,"timestamp":"18T17:15Z","wspeed":3,"wgust":6,"wdir":12,"wgustdir":15,"humidity":50,"airtemp":142,"dewpoint":123,"pressure":1024,"pressuretend":2,"visibility":153,"waterlevel":-84,"leveltrend":1,"cspeed":103,"cdir":256,"cspeed2":104,"cdir2":257,"cdepth2":10,"cspeed3":126,"cdir3":203,"cdepth3":20,"waveheight":42,"waveperiod":35,"wavedir":25,"swellheight":23,"swellperiod":48,"swelldir":124,"seastate":3,"watertemp":123,"preciptype":6,"salinity":53,"ice":0} {"class":"AIS","type":8,"repeat":0,"mmsi":992509977,"scaled":false,"dac":1,"fid":11,"lat":3197689,"lon":-368037,"timestamp":"18T17:45Z","wspeed":127,"wgust":127,"wdir":511,"wgustdir":511,"humidity":127,"airtemp":1447,"dewpoint":823,"pressure":1311,"pressuretend":3,"visibility":255,"waterlevel":411,"leveltrend":3,"cspeed":255,"cdir":511,"cspeed2":255,"cdir2":511,"cdepth2":31,"cspeed3":255,"cdir3":511,"cdepth3":31,"waveheight":255,"waveperiod":63,"wavedir":511,"swellheight":255,"swellperiod":63,"swelldir":511,"seastate":15,"watertemp":923,"preciptype":7,"salinity":511,"ice":3} +{"class":"AIS","device":"stdin","type":8,"repeat":0,"mmsi":992509977,"scaled":false,"dac":1,"fid":31,"lat":3197696,"lon":-368044,"accuracy":false,"timestamp":"29T23:24Z","wspeed":127,"wgust":127,"wdir":360,"wgustdir":360,"humidity":101,"airtemp":-1024,"dewpoint":501,"pressure":1311,"pressuretend":3,"visgreater":false,"visibility":127,"waterlevel":3001,"leveltrend":3,"cspeed":255,"cdir":360,"cspeed2":255,"cdir2":360,"cdepth2":31,"cspeed3":255,"cdir3":360,"cdepth3":31,"waveheight":255,"waveperiod":63,"wavedir":360,"swellheight":255,"swellperiod":63,"swelldir":360,"seastate":13,"watertemp":501,"preciptype":7,"salinity":510,"ice":3} {"class":"AIS","type":9,"repeat":0,"mmsi":111265591,"scaled":false,"alt":15,"speed":0,"accuracy":false,"lon":7128960,"lat":34667073,"course":0,"second":28,"regional":0,"dte":0,"raim":false,"radio":24597} {"class":"AIS","type":10,"repeat":0,"mmsi":366814480,"scaled":false,"dest_mmsi":366832740} {"class":"AIS","type":10,"repeat":0,"mmsi":440882000,"scaled":false,"dest_mmsi":366972000} diff --git a/www/AIVDM.txt b/www/AIVDM.txt index 76f0f75c..a58b7322 100644 --- a/www/AIVDM.txt +++ b/www/AIVDM.txt @@ -1853,7 +1853,7 @@ update for it in <>. Breakdowns of selected Message 8 subtypes from <> follow. (These are not yet implemented by GPSD.) -==== Meteorological and Hydrological Data (IMO236) === +==== Meteorological and Hydrological Data (IMO236) ==== A message 8 subtype. DAC = 001 FID = 11. Fixed length, 352 bits. This is in use and described in <>, but has been deprecated by @@ -1974,7 +1974,7 @@ WMO 306 Code table 4.201 specifies the following precipitatiuon type values: .Precipitation Types [width="50%",frame="topbot",options="header"] |=================================== -|Code |Position Fix Type +|Code |Precipitation Type |0 |Reserved |1 |Rain |2 |Thunderstorm @@ -3207,90 +3207,92 @@ decimeters), and (c) end padding changes from 6 to 10 bits. |81-104 | 24 |Latitude |lat |I3|Unit = minutes * 0.001, N positive, S negative, 91000 = N/A (default). -|105-105 | 1 |Fix quality |accuracy |u|As in Common Navigation Block +|105-105 | 1 |Fix quality |accuracy |b|As in Common Navigation Block |106-110 | 5 |Day |day |u|1-31, 0=N/A (default) |111-115 | 5 |Hour |hour |u|0-23, 24=N/A (default) |116-121 | 6 |Minute |minute |u|0-59, 60=N/A (default) |122-128 | 7 |Average Wind Speed |wspeed |u|10-min avg wind speed: knots, 126 = wind >= 126 knots, - 17 = N/A (default). + 127 = N/A (default). |129-135 | 7 |Gust Speed |wgust |u|10-min max wind speed: knots, 126 = wind >= 126 knots, - 17 = N/A (default). + 127 = N/A (default). |136-144 | 9 |Wind Direction |wdir |u|0-359, true bearing, 360 = N/A (default). |145-153 | 9 |Wind Gust Direction|wgustdir |u|0-359, true bearing, 360 = N/A (default). -|154-164 | 11 |Air Temperature |airtemp |U1|Dry bulb temp: units 0.1C, +|154-164 | 11 |Air Temperature |airtemp |I1|Dry bulb temp: units 0.1C, -60.0 to +60.0, -1024 = N/A (default). |165-171 | 7 |Relative Humidity |humidity |u|0-100%: units of 1%, 101 = N/A (default). -|172-181 | 10 |Dew Point |dewpoint |U1|-20.0 to +50.0: units 0.1C, +|172-181 | 10 |Dew Point |dewpoint |I1|-20.0 to +50.0: units 0.1C, 501 = N/A (default). |182-190 | 9 |Air Pressure |pressure |u|800-1200hPa, 1hPa, 0 = pressure <= 799hPa, 402 = pressure >= 1201 hPa, - 403 = N/A (default). + 511 = N/A (default). |191-192 | 2 |Pressure Tendency |pressuretend|e|0 = steady, 1 = decreasing, 2 = increasing, - 3 - N/A (default). + 3 = N/A (default). |193-193 | 7 |Max. visibility |visgreater |b|Visibility greater than. |194-200 | 8 |Horiz. Visibility |visibility |U1|Units are 0.1 nautical miles, 127 = N/A (default). |201-212 | 12 |Water Level |waterlevel |U2|-10.0 to +30.0 in 0.01m, -10.0m after scaling, - 40001 = N/A (default). + 4001 = N/A (default). |213-214 | 2 |Water Level Trend |leveltrend |e|0 = steady, 1 = decreasing, 2 = increasing, - 3 - N/A (default). + 3 = N/A (default). |215-222 | 8 |Surface Current Speed |cspeed |U1|0.0-25.0: units 0.1 knot, 251 = speed >= 25.1 knots, - 255 N/A (default). + 255 = N/A (default). |223-231 | 9 |Surface Current Direction |cdir |u|0-359: deg. fom true north, 360 = N/A (default). |232-239 | 8 |Current Speed #2 |cspeed2 |U1|0.0-25.0 knots: units 0.1 knot, 251 = speed >= 25.1 knots, - 255 N/A (default). + 255 = N/A (default). |240-248 | 9 |Current Direction #2 |cdir2 |u|0-359: true bearing, 360 = N/A (default). |249-253 | 5 |Measurement Depth #2 |cdepth2 |U1|0-30m down: units 0.1m, 31 = N/A (default). |254-261 | 8 |Current Speed #3 |cspeed3 |U1|0.0-25.0 knots: units 0.1 knot, 251 = speed >= 25.1 knots, - 255 N/A (default). + 255 = N/A (default). |262-270 | 9 |Current Direction #3 |cdir3 |u|0-359: true bearing, 360 = N/A (default). |271-275 | 5 |Measurement Depth #3 |cdepth3 |u|0-30m down: units 0.1m, 31 = N/A (default). |276-283 | 8 |Wave Height |waveheight|U1|Height 0-25m: units 0.1m, 251 = height >= 25.1m, - 255 N/A (default). + 255 = N/A (default). |284-289 | 6 |Wave Period |waveperiod|u|Seconds, 0-60, units 1s, 63 = N/A (default). |290-298 | 9 |Wave Direction |wavedir |u|0-359: true bearing, 360 = N/A (default). |299-306 | 8 |Swell Height |swellheight|U1|0-25m: units 0.1m, 251 = height >= 25.1m, - 255 N/A (default). + 255 = N/A (default). |307-312 | 6 |Swell Period |swellperiod|u|0-60, units 1s 360 = N/A (default) |313-321 | 9 |Swell Direction |swelldir |u|0-359: true bearing, 360 = N/A (default) |322-325 | 4 |Sea State |seastate |e|See "Beaufort scale" -|326-335 | 10 |Water Temperature |watertemp |U1|-10.0 to 50.0 C: +|326-335 | 10 |Water Temperature |watertemp |I1|-10.0 to 50.0 C: units 0.1 deg, - 601 = N/A (default) - Otherwise -10m after scaling -|336-338 | 3 |Precipitation |precipitation |u|preciptype + 501 = N/A (default) +|336-338 | 3 |Precipitation |preciptype |e|See "Precipitation type" |339-347 | 9 |Salinity |salinity |U1|0.0-50.0%: units of 0.1% 501 = salinity >= 50.1% 510 = N/A (default) - 511 - sensor not available -|348-349 | 2 |Ice |ice |b|Yes/No + 511 = sensor not available +|348-349 | 2 |Ice |ice |u| 0 = No + 1 = Yes + 2 = (reserved for future use) + 3 = not available = default |350-359 | 10 |Spare | |x|Not used |============================================================================== -- cgit v1.2.1