Repository navigation
Network layer. Discovery and polling quick start
The Network layer. Compile and run example page describes how to compile and run EviNS on you local machine. There you can find the EviNS configuration for polling and the discovery procedure with some simple examples. Please go to this page for more details.
The current page describes in more detail how to start polling and send data. To start polling you have to take some simple steps:
- Start discovery
- Set protocol to send data
- Start polling
- Send data
- Get position
The discovery procedure is used to find the neighbours in the network. Using the neighbour information the routing table for the static (polling) routing protocol will be updated and can be used for data transmission.
To update the routing table, start the discovery procedure once more.
The NL format to start discovery (see also Polling commands / Star topology):
NL,start,discovery,<Discovery period>,<Discovery total time>During the discovery total time, the modem will try to discover neighbours / times.
In the example below we run the discovery procedure for 30 seconds. After 30 s of discovery time (30/10 – 3 times sending a broadcast), you will get an NL,routing asynchronous message which means the discovery procedure is completed. During the discovery time, the channel is busy and you cannot transmit messages.
NL,start,discovery,10,30
NL,discovery,ok
NL,routing,3->3,2->2,4->4If you got the routing asynchronous message after the discovery procedure, the routing table will be updated for polling.
Since the discovery procedure uses flooding routing protocols, to start polling you have to set the polling protocol first.
NL,get,protocols
NL,protocols,polling,sncfloodr
NL,set,protocol,polling
NL,protocol,pollingAfter that, you can check if the routing table was updated.
NL,get,routing
NL,routing,3->3,2->2,4->4Due to the underwater conditions and channel busyness it is sometimes not possible to deliver a big amount of data. In order to control such amount, we decided to integrate a message queue, which can be transmitted due to a polling request.
The discovery procedure automatically sets the polling sequence (a list of addresses known by the routing table) using the updated routing table. During the polling loop these addresses will be requested to send data.
If necessary, you can manually change the polling sequence (for instance to make sure certain modems are addressed first).
Set polling sequence:
# Check routing table
NL,get,routing
NL,routing,3->3,2->2,4->4
# Set polling sequence 2,3,4
NL,set,polling,seq,2,3,4
NL,polling,2,3,4NL,start,polling,[n|nb]As you see, the start polling command has the optional flags b and nb. These flags decide if we need to get data buffered on the remote address.
| b | to get burst data from the remote address |
|---|---|
| nb | to ignore burst data, to send only pbm to update the position |
There are 4 types of messages: sensitive, tolerant, broadcast and alarm (see the description below).
| Tolerant | Tolerant messages are queued and are never dropped. A tolerant message will be sent if its remote address is requested during the polling loop. The message will be removed from the queue if it was successfully delivered. |
|---|---|
| Sensitive | Sensitive messages are queued in limited numbers. If there are more than 3 of them, the oldest one will be dropped. A sensitive message will be sent if its remote address is requested during the polling loop. The message will be removed from the queue if it was successfully delivered. |
| Broadcast | Broadcast messages are not queued. This message type has priority over tolerant/sensitive messages and will be sent first, other data will sent later. The message will be removed if it was successfully delivered. |
| Alarm | An alarm message will be broadcasted through the whole network immediately while everything else will be ignored. The polling loop will be stopped. |
Format:
NL,send,[alarm|broadcast|tolerant|sensitive],Len,Dst,DataIn the example below it is assumed that you have 4 EvoLogics modems:
- Modem 1 is on the surface, starts the polling loop and polls through the modems with addresses 2,3,4.
- Modem 2,3,4 are on the bottom, collecting data to send to the surface.
Modem 1:
# start discovery and wait till the async message NL,routing..
NL,start,discovery,5,10
NL,discovery,ok
NL,routing,2->2,3->3,4->4
# set protocol polling
NL,set,protocol,polling
NL,protocol,polling
# start polling loop with a burst data request
NL,start,polling,b
NL,polling,okModem 2, 3, 4:
# set protocol polling
NL,set,protocol,polling
NL,protocol,pollingSending tolerant / sensitive / broadcast messages from Modem 2, 3, 4
Modem 2:
#send tolerant messages to modem 1
NL,send,tolerant,24,1,I am modem 2. Tolerant 1
NL,send,0
NL,send,tolerant,24,1,I am modem 2. Tolerant 2
NL,send,0
NL,send,tolerant,24,1,I am modem 2. Tolerant 3
NL,send,0Modem 3:
# send 4 sensitive messages to modem 1. The max amount of
# sensitive messages is 3. The first one (oldest) will be dropped
NL,send,sensitive,25,1,I am modem 3. Sensitive 1
NL,send,0
NL,send,sensitive,25,1,I am modem 3. Sensitive 2
NL,send,0
NL,send,sensitive,25,1,I am modem 3. Sensitive 3
NL,send,0
NL,send,sensitive,25,1,I am modem 3. Sensitive 4
NL,send,0Modem 4:
#send broadcast messages to modem 1. Only the newest one will be transmitted.
NL,send,broadcast,25,1,I am modem 4. Broadcast 1
NL,send,0
NL,send,broadcast,25,1,I am modem 4. Broadcast 2
NL,send,0=====> Modem 1 receives messages from the modems 2,3 and 4 successively due to the polling sequence
Modem 1:
# receiving all tolerant messages form modem 2
NL,recv,24,1,2,I am modem 2. Tolerant 1
NL,recv,24,1,2,I am modem 2. Tolerant 2
NL,recv,24,1,2,I am modem 2. Tolerant 3
# receiving 3 newest sensitive messages form modem 3
NL,recv,25,1,3,I am modem 3. Sensitive 2
NL,recv,25,1,3,I am modem 3. Sensitive 3
NL,recv,25,1,3,I am modem 3. Sensitive 4
# receiving the last broadcast message form modem 4
NL,recv,25,1,4,I am modem 4. Broadcast 2Modem 1:
# send tolerant messages to modem 2
NL,send,tolerant,27,2,I am modem 1. Tolerant to 2
NL,send,0
# send sensitive messages to modem 3
NL,send,tolerant,28,3,I am modem 1. Sensitive to 3
NL,send,0
#send broadcast messages to modem 4
NL,send,broadcast,30,4,I am modem 1. Broadcast 3 to 4
NL,send,0Modem 2:
NL,recv,27,1,2,I am modem 1. Tolerant to 2Modem 3:
NL,recv,28,1,3,I am modem 1. Sensitive to 3Modem 4:
NL,recv,30,1,4,I am modem 1. Broadcast 3 to 4Sometimes you will receive the same message multiple times because the message could not be successfully delivered and modem 1 will try to send it again on the next loop.
An alarm message will be broadcasted through the whole network.The polling loop will be stopped if an alarm message was received.
Modem 4:
NL,send,alarm,,1,SOSModem 1, 2, 3:
NL,recv,3,4,255,SOSUsing the Evins configuration file described in Network layer. Compile and run example, there is an extra socket where you can get position information (the nmea interface).
The EviNS positioning module runs in the background. During the polling loop and data exchange we are getting positions of each modem in the network.