AIS distance graphing

  • Thread starter Thread starter GHA
  • Start date Start date

GHA

Well-Known Member
Joined
26 Jun 2013
Messages
12,552
Location
Hopefully somewhere warm
Visit site
This seems to work, possible of interest to a few and possibly no one will bother to try anything ;)

So, you are fiddling with your ais and interested in how well it's receiving...

Graph the distance of target received should help, fiddle with the antenna, wait an hour or 3 and see if it looks better.

How it works - the ais data goes into the (wonderful :) ) signalk. Then in a add on in signalk it strips out just the ais messages, calculates the distance from your boat and sends that to a database, then look it :)

In the off chance of anyone actually giving it a go just ask & I'll do a better how to, but signalk is easy to install and set up these days, windows or linux anyway, dunno about mac. Also required is influxdb database and a prog called chronograf (or grafana, similar) which does the work of making pretty graphs. Below is some data from a sample nmea file running on the voyage data recorder in opencpn and sending all the data to signalk. I got bit bored early on about 8pm and turned up the speed of playback.
Might be useful if anyone wants it. Not so sure about the calcs - cut n paste from the web - look right?

let _ = global.get('lodash')
let app = global.get('app')
let position = app.getSelfPath('navigation.position.value')

msg.lat1 = position.latitude;
msg.lon1 = position.longitude;

msg.lat2 = msg.payload.latitude;
msg.lon2 = msg.payload.longitude;

var p = 0.017453292519943295; // Math.PI / 180
var c = Math.cos;
var a = 0.5 - c((msg.lat2 - msg.lat1) * p)/2 + c(msg.lat1 * p) * c(msg.lat2 * p) * (1 - c((msg.lon2 - msg.lon1) * p))/2;

msg.payload = 12742/ 1.852 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km
msg.topic = 'temp.ais.distance'
return msg;

iqPl9I1.png
 
Last edited:
Hi there P.
was "fiddling" with my ais yesterday and getting very poor results on transmission. Reception seems pretty good. I've been using a quarter dipole (home made) and also a rubber ducky pulled halfway up the mast. Neither gets my transmissions onto the web based receiver stations. I connected to my main vhf mast antenna and everything works great and am being picked up by their receiver stations ok.
I don't want to install another mast head, and don't really want to use a splitter on the main antenna.
So do I buy another standard vhf antenna and try and get it up in the air a bit more or should I persevere with the dipole, or even make another one and try that.
Out of interest what are you using on yours, or are you receive only?
 
Hi there P.
was "fiddling" with my ais yesterday and getting very poor results on transmission. Reception seems pretty good. I've been using a quarter dipole (home made) and also a rubber ducky pulled halfway up the mast. Neither gets my transmissions onto the web based receiver stations. I connected to my main vhf mast antenna and everything works great and am being picked up by their receiver stations ok.
I don't want to install another mast head, and don't really want to use a splitter on the main antenna.
So do I buy another standard vhf antenna and try and get it up in the air a bit more or should I persevere with the dipole, or even make another one and try that.
Out of interest what are you using on yours, or are you receive only?
Last year at SIBS a stand suggested using a small dumpy aerial fitted on the crosstrees if you didn't or couldn't use your main aerial. I'm not to sure whether the mast will affect transmissions in one direction though.
 
Looking at just numbers or plotting the data is like looking through a keyhole into a dark room or opening the door and turning on the light. :cool:

My AIS display already plots the data - on a chart!

If I want to get an impression of how far away it's receiving targets, I just zoom out a long way.

Pete
 
My AIS display already plots the data - on a chart!

If I want to get an impression of how far away it's receiving targets, I just zoom out a long way.

Pete
Except it won't flag up small differences in the data, see post 3, and try potting data, it really does open the door on so much detail going on which you really won't spot just glancing at a screen.

For a technical forum there's a lot of negativity against actually trying to learn more on here ;)

Should have posted in the "why bother, just give up" forum ;) ;)
 
Hi there P.
was "fiddling" with my ais yesterday and getting very poor results on transmission. Reception seems pretty good. I've been using a quarter dipole (home made) and also a rubber ducky pulled halfway up the mast. Neither gets my transmissions onto the web based receiver stations. I connected to my main vhf mast antenna and everything works great and am being picked up by their receiver stations ok.
I don't want to install another mast head, and don't really want to use a splitter on the main antenna.
So do I buy another standard vhf antenna and try and get it up in the air a bit more or should I persevere with the dipole, or even make another one and try that.
Out of interest what are you using on yours, or are you receive only?
Receive only here for now, not sure what's best, maybe see how it is in the anchorage away from all those masts, the web receivers seem to be a bit odd sometimes.
 
Someone has run out of things to do! ;)
On a boat? Never :)
Actually was mostly quick as signalk/node red makes data fiddling so easy. Started off with playing around with calcing distance between 2 lat/longs. The equation was cut and paste straight from the web, haversine is it?
Filtering out all the other messages didn't take too long either, always things to learn :cool:


var p = 0.017453292519943295; // Math.PI / 180
var c = Math.cos;
var a = 0.5 - c((msg.lat2 - msg.lat1) * p)/2 + c(msg.lat1 * p) * c(msg.lat2 * p) * (1 - c((msg.lon2 - msg.lon1) * p))/2;
msg.payload = 12742/ 1.852 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km
 
*Much* easier ways like filter out just that mmsi, but you don't need to. Plot the data it's simple to see and ignore.

I`ve had great fun playing with geofencing and can see loads of relevant applications to filtering AIS data ..... our vehicle navigation systems track hundreds of geofenced areas simultaneously with very little performance impact.
 
Name one,
and how? Where does the code go? .......... ;)

Why not just use the opencpn watchdog?

Could set up a section of a shipping lane as a geofence and see how many commercial AIS targets are in it - measure of how much traffic is coming your way before attempting a crossing? ... or set up a geofence gate and build a profile of traffic flow for the entrance to a particular harbour or stretch of water - are there particularly busy periods?

Like I said, geofencing has loads of applications for automotive, if you can't see any for AIS data sets then fine, don't use it - and I'm sure your capable of working out where the code would go. ;)
 
The question should be not so much about the distant vessels your AIS sees, but the closer ones it is blind to?
One could gather stats about the distance at which various species of vessel first appear and subsequently disappear.

Or you could go sailing.
 
Top