fix console.pl max scroll depth
[spider.git] / RBN.mojo
1 9th July 2020
2 -------------
3
4 IF YOU ARE ON THE MASTER BRANCH, STOP (I REPEAT) STOP READING THIS
5 DOCUMENT AND READ UPGRADE.mojo FIRST.
6
7
8 If you are not on an existing 'mojo' branch, or you have a build less
9 than 260, please stop reading as well and read UPGRADE.mojo (in the
10 section about installing packages), as you need to install some extra
11 packages before restarting the new version of the code. If in doubt
12 try installing the packages again as this will either confirm that all
13 is already done or will install what's missing.
14
15 Assuming you have done the above:
16
17 The latest release of the Mojo branch of DXSpider contains a client
18 for the Reverse Beacon Network (RBN). This is not a simple client, it
19 attempts to make some sense of the 10s of 1000s of "spots" that the
20 RBN can send PER HOUR. At busy times, actually nearly all the time, the
21 spots from the RBN come in too quickly for anybody to get anything more
22 than a fleeting impression of what's coming in.
23
24 Something has to try to make this manageable - which is what I have
25 tried to do with DXSpider's RBN client.
26
27 The RBN has a number of problems (apart from the overwhelming quantity
28 of data that it sends):
29
30 * Spotted callsigns, especially on CW, are not reliably
31   decoded. Estimates vary as to how bad it is but, as far as I can
32   tell, even these estimates are unreliable!
33
34 * The frequency given is unreliable. I have seen differences as great
35   as 600hz on CW spots.
36
37 * There is far too much (in my view) useless information in each spot
38   - even if one had time to read, decode and understand it before the
39   spot has scrolled off the top of the screen.
40
41 * The format of the comment is not regular. If one has both FTx and
42   "all the other" spots (CW, PSK et al) enabled at the same time,
43   one's eye is constantly having to re-adjust. Again, very difficult
44   to deal with on contest days. Especially if it mixed in with
45   "normal" spots.
46
47 So what have I done about this? Look at the sample of input traffic
48 below:
49
50 05Jul2020@22:59:31 (chan) <- I SK0MMR DX de KM3T-2-#:  14100.0  CS3B           CW    24 dB  22 WPM  NCDXF B 2259Z
51 05Jul2020@22:59:31 (chan) <- I SK0MMR DX de KM3T-2-#:  28263.9  AB8Z/B         CW    15 dB  18 WPM  BEACON  2259Z
52 05Jul2020@22:59:31 (chan) <- I SK0MMR DX de LZ3CB-#:   7018.20  RW1M           CW    10 dB  18 WPM  CQ      2259Z
53 05Jul2020@22:59:31 (chan) <- I SK0MMR DX de W9XG-#:    14057.6  K7GT           CW     7 dB  21 WPM  CQ      2259Z
54 05Jul2020@22:59:31 (chan) <- I SK0MMR DX de G0LUJ-#:   14100.1  CS3B           CW    18 dB  20 WPM  NCDXF B 2259Z
55 05Jul2020@22:59:32 (chan) <- I SK0MMR DX de LZ4UX-#:    7018.3  RW1M           CW    13 dB  18 WPM  CQ      2259Z
56 05Jul2020@22:59:32 (chan) <- I SK0MMR DX de LZ4AE-#:    7018.3  RW1M           CW    28 dB  18 WPM  CQ      2259Z
57 05Jul2020@22:59:32 (chan) <- I SK0MMR DX de W1NT-6-#:  28222.9  N1NSP/B        CW     5 dB  15 WPM  BEACON  2259Z
58 05Jul2020@22:59:32 (chan) <- I SK0MMR DX de W1NT-6-#:  28297.0  NS9RC          CW     4 dB  13 WPM  BEACON  2259Z
59 05Jul2020@22:59:32 (chan) <- I SK0MMR DX de F8DGY-#:    7018.2  RW1M           CW    23 dB  18 WPM  CQ      2259Z
60 05Jul2020@22:59:33 (chan) <- I SK0MMR DX de 9A1CIG-#:  7018.30  RW1M           CW    20 dB  18 WPM  CQ      2259Z
61 05Jul2020@22:59:33 (chan) <- I SK0MMR DX de LZ7AA-#:    7018.3  RW1M           CW    16 dB  18 WPM  CQ      2259Z
62 05Jul2020@22:59:33 (chan) <- I SK0MMR DX de DK9IP-#:    7018.2  RW1M           CW    21 dB  18 WPM  CQ      2259Z
63 05Jul2020@22:59:33 (chan) <- I SK0MMR DX de WE9V-#:    10118.0  N5JCB          CW    15 dB  10 WPM  CQ      2259Z
64 05Jul2020@22:59:34 (chan) <- I SK0MMR DX de DJ9IE-#:    7028.0  PT7KM          CW    15 dB  10 WPM  CQ      2259Z
65 05Jul2020@22:59:34 (chan) <- I SK0MMR DX de DJ9IE-#:    7018.3  RW1M           CW    31 dB  18 WPM  CQ      2259Z
66 05Jul2020@22:59:34 (chan) <- I SK0MMR DX de DD5XX-#:    7018.3  RW1M           CW    21 dB  18 WPM  CQ      2259Z
67 05Jul2020@22:59:34 (chan) <- I SK0MMR DX de DE1LON-#:  14025.5  EI5JF          CW    13 dB  19 WPM  CQ      2259Z
68 05Jul2020@22:59:34 (chan) <- I SK0MMR DX de DE1LON-#:   7018.3  RW1M           CW    24 dB  18 WPM  CQ      2259Z
69 05Jul2020@22:59:34 (chan) <- I SK0MMR DX de ON6ZQ-#:    7018.3  RW1M           CW    22 dB  18 WPM  CQ      2259Z
70 05Jul2020@22:59:34 (chan) <- I SK0MMR DX de OH6BG-#:    3516.9  RA1AFT         CW    15 dB  25 WPM  CQ      2259Z
71 05Jul2020@22:59:35 (chan) <- I SK0MMR DX de HA1VHF-#:   7018.3  RW1M           CW    30 dB  18 WPM  CQ      2259Z
72 05Jul2020@22:59:35 (chan) <- I SK0MMR DX de F6IIT-#:    7018.4  RW1M           CW    32 dB  18 WPM  CQ      2259Z
73 05Jul2020@22:59:36 (chan) <- I SK0MMR DX de HB9BXE-#:   7018.3  RW1M           CW    23 dB  18 WPM  CQ      2259Z
74 05Jul2020@22:59:37 (chan) <- I SK0MMR DX de SM0IHR-#:   7018.3  RW1M           CW    21 dB  18 WPM  CQ      2259Z
75 05Jul2020@22:59:37 (chan) <- I SK0MMR DX de DK0TE-#:    7018.3  RW1M           CW    26 dB  18 WPM  CQ      2259Z
76 05Jul2020@22:59:37 (chan) <- I SK0MMR DX de OE9GHV-#:   7018.3  RW1M           CW    40 dB  19 WPM  CQ      2259Z
77 05Jul2020@22:59:37 (chan) <- I SK0MMR DX de CX6VM-#:   10118.0  N5JCB          CW    20 dB  10 WPM  CQ      2259Z
78 05Jul2020@22:59:37 (chan) -> D G1TST DX de F8DGY-#:     7018.3 RW1M         CW  23dB Q:9* Z:20           16 2259Z 14
79 05Jul2020@22:59:38 (chan) <- I SK0MMR DX de HB9JCB-#:   7018.3  RW1M           CW    16 dB  18 WPM  CQ      2259Z
80 05Jul2020@22:59:39 (chan) <- I SK0MMR DX de HB9JCB-#:   3516.9  RA1AFT         CW     9 dB  26 WPM  CQ      2259Z
81 05Jul2020@22:59:39 (chan) <- I SK0MMR DX de KO7SS-7-#:  14057.6  K7GT           CW     6 dB  21 WPM  CQ      2259Z
82 05Jul2020@22:59:39 (chan) <- I SK0MMR DX de K9LC-#:    28169.9  VA3XCD/B       CW     9 dB  10 WPM  BEACON  2259Z
83 05Jul2020@22:59:40 (chan) <- I SK0MMR DX de HB9DCO-#:   7018.2  RW1M           CW    25 dB  18 WPM  CQ      2259Z
84 05Jul2020@22:59:40 (chan) <- I SK0MMR DX de EA5WU-#:    7018.3  RW1M           CW    19 dB  18 WPM  CQ      2259Z
85
86 * As you can see, there are frequently more than one spotter for a
87   callsign:
88
89 * I normalise the frequency and cache up to 9 copies from different
90   spots. In order to do this I have to wait a few (configurable) seconds
91   for the client to collect a reasonable number of copies. More copies 
92   may come in after 9 copies have been received. Once I have enough 
93   copies to be sure that the callsign is at least agreeed upon by more
94   than one skimmer, or the wait timer goes off, I emit a spot.  By this
95   means I can reduce the number of spots sent to a node user by up to a
96   factor of around 10 for CW etc spots and about 8 for FTx spots.
97
98   For example, from the trace above, all the RW1M RBN spots become just
99   one line:
100
101 DX de F8DGY-#:     7018.3 RW1M         CW  23dB Q:9* Z:20           16 2259Z 14
102
103 * No RBN spots can leak out of the node to the general cluster. Each
104   node that wants to use the RBN *must* establish their own
105   connections to the RBN.
106
107 * Currently no RBN spots are stored. This may well change but how and
108   where these spots are stored is not yet decided. Only "DXSpider
109   curated" spots (like the example above) will be stored (if/when they
110   are). Sh/dx will be suitably modified if storage happens. 
111
112 * There are some things that need to be explained:
113
114 a) The input format from the RBN is not the same as format emitted by
115 the cluster node. This is part of the unhelpfulness to mixing a raw
116 RBN feed with normal spots.
117
118 b) Each spot sent out to a node user has a "Qwalitee" marker, In this
119 case Q:9*. The '9' means that I have received 9 copies of this spot
120 from different skimmers and, in this case, they did not agree on the
121 frequency (7018.2 - 7018.4) which is indicated by a '*'. The frequency
122 shown is the majority decision. If this station has been active for
123 for a while and he is still calling CQ after some time (configurable,
124 but currently 60 minutes), ignoring gaps for QSOs or tea breaks, then
125 a '+' character will be added.
126
127 If the "Qualitee" Q:1 is seen on a CW spot, then only one skimmer has
128 seen that spot and the callsign *could* be wrong, but frequently, if
129 it is wrong, it is more obvious than the example below. But if Q is
130 Q:2 and above, then the callsign is much more likely to be correct.
131
132 DX de DJ9IE-#:    14034.9 UN7BBD       CW   4dB Q:5*+              17 1444Z 14
133 DX de OL7M-#:     14037.9 UA6LQ        CW  13dB Q:7                16 1448Z 15
134 DX de LZ3CB-#:    28050.2 DL4HRM       CW   7dB Q:1                14 1448Z 20
135
136 Having said that, I check every spots call with the standard DXSpider
137 is_callsign routine, to check that the callign is a valid format. Then
138 through the Prefix::search routine, to check that the prefix actually
139 exists. If either of these checks fails then the spot is ignored.
140
141 c) I ditch the WPM and the 'CQ' as not being hugely relevant. 
142
143 d) If there is a Z:nn[,mm...], then this spot was also heard by
144 skimmers in other zones. In this example, it means that this call was
145 also heard in CQ Zone 20. This list does NOT include the cq zone of
146 the skimmer nor the spot. If you would like to see these then do
147 'set/dxcq'. This setting is active for all the examples in this
148 document. This is completely optional.
149
150 There can be a ',' separated list of as many zones where this spot was
151 also heard by another skimmers, up to the space available in the
152 comment area.
153
154 DX de LZ4UX-#:    14015.5 ON7TQ        CW   6dB Q:9 Z:5,14,15,40   14 0646Z 20
155 DX de VE7CC-#:     3573.0 N8ADO        FT8 -14dB Q:4 Z:4,5          4 0647Z  3
156 DX de DM7EE-#:    14027.5 R1AC         CW   9dB Q:9* Z:5,15,17,20  16 0643Z 14
157 DX de WE9V-#:      7074.0 EA7ALL       FT8 -9dB Q:2+ Z:5           14 0641Z  4
158
159 e) I shorten the skimmer callsign to 6 characters - having first
160 chopped off any SSIDs, spurious /xxx strings from the end, leaving
161 just the base callsign, before (re-)adding '-#' on the end. This is
162 done to minimise the misalignment of the spot rightwards, as in the
163 incoming skimmer spot from KO7SS-7-# below. There are some very
164 strange skimmer callsigns with all sorts of spurious endings, all of
165 which I attempt to reduce to the base callsign. Some skimmer base
166 callsigns still might be shortened for display purposes. Things like
167 '3V/K5WEM' won't fit in six characters but the whole base callsign is
168 used for zone info internally, but only the first 6 characters are
169 displayed in any spot.
170
171 05Jul2020@22:59:39 (chan) <- I SK0MMR DX de HB9JCB-#:   3516.9  RA1AFT         CW     9 dB  26 WPM  CQ      2259Z
172 05Jul2020@22:59:39 (chan) <- I SK0MMR DX de KO7SS-7-#:  14057.6  K7GT           CW     6 dB  21 WPM  CQ      2259Z
173 05Jul2020@22:59:39 (chan) <- I SK0MMR DX de K9LC-#:    28169.9  VA3XCD/B       CW     9 dB  10 WPM  BEACON  2259Z
174
175 f) I happen to have a filter set (accept/spot by_zone 14 and not zone
176 14 or zone 14 and not by_zone 14) which will give me the first spot
177 that either spot or skimmer is in zone 14 but its companion isn't. For
178 those of us that are bad at zones (like me) sh/dxcq is your
179 friend. You can have separate filters just for RBN spots if you want
180 something different to your spot filters. Use acc/rbn or rej/rbn. NB:
181 these will completely override your spot filters for RBN
182 spots. Obviously "real" spots will will continue to use the spot
183 filter(s). If you use set/dxcq, then unset/dxitu and unset/dxgrid
184 first. You only need to this once.
185
186 g) If there is NO filter in operation, then the skimmer spot with the
187 LOWEST signal strength will be shown. This implies that if any extra
188 zones are shown, then the signal will be higher in those zones.
189
190 h) A filter can further drastically reduce the output sent to the
191 user. As this STATS line shows:
192
193 23:22:45 (*) RBN:STATS hour SK0MMR raw: 5826 sent: 555 delivered: 70 users: 1
194
195 For this hour, I received 5826 raw spots from the CW etc RBN, which
196 produced 555 possible spots, which my filter reduced to 70 that were
197 actually delivered to G1TST. For the FTx RBN, I don't have a filter
198 active and so I got all the possibles:
199
200 23:22:45 (*) RBN:STATS hour SK1MMR raw: 13354 sent: 1745 delivered: 1745 users: 1
201
202 ---------------------------------------------------------------------
203
204 So how do you go about using this:
205
206 First you need to create one or two RBN user(s). Now you can use any call you
207 like and it won't be visible outside of the node. I call mine SK0MMR
208 and SK1MMR. One of these connects to the "standard" RBN port that
209 outputs CW, BEACON, DXF, PSK and RTTY spots, and the other connects to
210 the RBN port that just outputs FT4 and FT8 spots.
211
212 set/rbn sk0mmr sk1mmr
213
214 Now create connect scripts in /spider/connect/sk0mmr (and similarly
215 sk1mmr). They look like this:
216
217 /spider/connect/sk0mmr:
218
219 connect telnet telnet.reversebeacon.net 7000
220 'call:' '<node callsign here'
221
222 /spider/connect/sk1mmr:
223
224 connect telnet telnet.reversebeacon.net 7001
225 'call:' '<node callsign here'
226
227 Now put them in your local crontab in /spider/local_cmd/crontab:
228
229 * * * * * start_connect('sk0mmr') unless connected('sk0mmr')
230 * * * * * start_connect('sk1mmr') unless connected('sk1mmr')
231
232 This will check once every minute to see if each RBN connection is
233 active, you can check what is connected with the 'links' command:
234
235                                                  Ave  Obs  Ping  Next      Filters
236   Callsign Type Started                 Uptime    RTT Count Int.  Ping Iso? In  Out PC92? Address
237     GB7DJK DXSP  5-Jul-2020 1722Z     7h 6m 8s   0.02   2    300    89               Y    163.172.11.79
238     SK0MMR RBN   5-Jul-2020 1722Z     7h 6m 8s                 0     0                    198.137.202.75
239     SK1MMR RBN   5-Jul-2020 1722Z     7h 6m 8s                 0     0                    198.137.202.75
240
241 The RBN connections are sometimes dropped or become stuck. I have a
242 mechanism to detect this and it will disconnect that RBN connection
243 and, by this means,it will be automatically reconnected by the
244 crontab, just like any other (normal) node.
245
246 I use the crontab, rather than restarting immediately after
247 disconnection, to prevent race conditions (or just slow them down to
248 one disconnection a minute).
249
250 The first time a connection is made, after node startup, there is a 5 (configurable)
251 minute pause before RBN spots come out for users. This is done to fill
252 up (or "train") the cache. Otherwise the users will be overwhelmed by
253 spots - it slows down reasonably quickly - but experiment shows that 5
254 minutes is a reasonable compromise. The delay is configurable,
255 globally, for all RBN connections, but in future is likely to be
256 configurable per connection. Basically, because the FTx RBN data is
257 much more bursty and there is more of it (except on CW contests), it
258 could do with a somewhat longer training period than the CW etc RBN
259 connection.
260
261 If a connection drops and reconnects. There is no delay or extra
262 training time. If the node is stopped and restarted within a few
263 minutes, then no training time will occur.
264
265 For users. At the moment. There is a single command that sets or
266 unsets ALL RBN spot sorts:
267
268 Users can select which type(s) of RBN/Skimmer spot they require using
269 the 'set/skimmer' command. Users can enter the 'help set/skimmer'
270 command for more information on this. They can also enter then 'help
271 rbn' command for more information about how to interpret what DXSpider
272 produces and some other useful background information.
273
274 This still very much "work in progress" and will be subject to
275 change. But I am grateful to the feedback I have received, so far,
276 from:
277
278 Kin EA3CV
279 Andy G4PIQ
280 Mike G8TIC
281 Lee VE7CC
282
283 But if you have comments, suggestions or even brickbats, please email
284 me or the support list.
285
286 Dirk G1TLH
287