Synchronizing the network
Sleeping routers under DigiMesh allow to all nodes in the network to synchronize their sleep and wake up times. All synchronized nodes enter and exit into low power state at the same time. This forms a cyclic sleeping network. Nodes synchronize by receiving a special RF packet called 'synch' message which is sent by a sleep coordinator. Any node in the network can become a sleep coordinator through a process called nomination. The sleep coordinator will send one synch message at the beginning of each wake up period. The synch message to broadcast category is repeated by each node in the network, since it belongs.

Operation

One node in a sleeping network acts as the sleeping coordinator. At the beginning of a wake cycle the sleep coordinator will send a sync message as a broadcast to all nodes in the network. This message contains synchronization information and the wake and sleep times for the current cycle. All cyclic sleep nodes receiving a sync message will remain awake for the wake time and then sleep for the sleep period specified.

Synchronization messages

Nodes which have not been synchronized or that have lost sync will send messages requesting sync information. Synchronized nodes which receive one of these messages will respond with a synchronization packet.
Deployment mode (set by default) is used by sleep compatible nodes when they are first powered up and the sync message has not been relayed. A sleep coordinator in deployment mode will rapidly send sync messages until it receives a relay of one of those messages. If a node which has exited deployment mode receives a sync message from a sleep coordinator which is in deployment mode, the sync will be rejected and a corrective sync will be sent to the sleep coordinator. Deployment mode can be disabled using the sleep options command (SO).
A sleep coordinator which is not in deployment mode or which has had deployment mode disabled will send a sync message at the beginning of the wake cycle The sleep coordinator will then listen for a neighboring node to relay the sync. If the relay is not heard, the sync coordinator will send the sync one additional time.

Becoming a sleep coordinator

A node can become a sleep coordinator in one of several ways:

Preferred sleep coordinator

A node can be specified to always act as a sleep coordinator. This is done by setting the preferred sleep coordinator bit (SO=1). Besides, it is necessary to set the synchronous sleep support mode (SM=7) in order to synchronize with the rest of the network nodes.
A node with the sleep coordinator bit set will always send a sync message at the beginning of a wake cycle. For this reason, it is imperative that no more than one node in the network has this bit set. Although it is not necessary to specify a preferred sleep coordinator, it is often useful to select a node for this purpose to improve network performance.
The preferred sleep coordinator bit should be used with caution. The advantages of using the option become weaknesses when used on a node that is not positioned or configured properly.

Nomination and election

Nomination is the process where a node becomes a sleep coordinator at the start of a sleeping network or in the event a sleep coordinator fails as a replacement. This process is automatic with any sleeping node being eligible to become the sleep coordinator for the network. This process can be managed through 'Sleep Options' by allowing a node to alter the algorithm used for nomination giving the node a greater chance to become the sleep coordinator. This option is designed for maintenance purposes and is not necessary for cyclic sleep operation.
If the node has the preferred sleep coordinator option-enabled ('Sleep Options'=1), then it will poll during its first cycle for a synch message. If it becomes synched by receiving a synch message, it will cycle back to sleep and will not become the sleep coordinator. If it does not become synched during that first cycle, then it will nominate itself as the sleep coordinator and will start sending synch messages at the start of its second cycle.
Any sleeping node, if it does not receive a message for three cycles, may nominate itself to act as a replacement sleep coordinator.
Depending on the platform and other configured options, such a node will eventually nominate itself after a number of cycles without a sync. A nominated node will begin acting as the new network sleep coordinator. If multiple nodes nominate themselves at the same time, then an election will take place to resolve which node will function as network's sleep coordinator.
A node will disable synching if it receives a synch message from a senior node. A node running in normal mode (with preferred sleep coordinator option enabled) is senior to any node operating in sleep mode. A node with the largest MAC address value is senior to any other node operating in the same mode.

Changing sleep parameters

Any sleep compatible node in the network which does not have the non-sleep coordinator sleep option set can be used to make changes to the network's sleep and wake times. If a node's SP and/or ST are changed to values different from those that the network is using, that node will become the sleep coordinator. That node will begin sending sync messages with the new sleep parameters at the beginning of the next wake cycle.

Configuration

Starting a sleeping network

By default, all new nodes operate in normal (non-sleep) mode. To start a sleeping network, follow these steps:
    1.
    Enable the preferred sleep coordinator option on one of the nodes (SO=1), and set its the sleep compatible mode (SM=7).
    Sleep/Awake periods (SP and ST parameters) should be set to a quick cycle time.
    2.
    Next, power on the new nodes within range of the sleep coordinator. The nodes will quickly receive a sync message and synchronize themselves to the short cycle SP and ST.
    3.
    Configure the new nodes in their desired sleep mode as cyclic sleeping nodes (SM=8) or sleep support nodes (SM=7).
    4.
    Set the SP and ST values on the sleep coordinator to the desired values for the deployed network.
    5.
    Wait a cycle for the sleeping nodes to sync themselves to the new SP and ST values.
    6.
    Disable the preferred sleep coordinator option bit on the sleep coordinator (unless a preferred sleep coordinator is desired).
    7.
    Deploy the nodes to their positions.

Adding a new node to an existing network

To add a new node to the network, the node must receive a sync message from a node already in the network. On power-up, an unsynchronized sleep compatible node will periodically send a broadcast requesting a sync message and then sleep for its SP period. Any node in the network that receives this message will respond with a sync. Because the network can be asleep for extended periods of time, and as such cannot respond to requests for sync messages, there are methods that can be used to sync a new node while the network is asleep. e.g. Power the new node on within range of a sleep support node. Sleep support nodes are always awake and will be able to respond to sync requests promptly.

Changing sleep parameters

Changes to the sleep and wake cycle of the network can be made by changing the SP and/or ST of the sleep coordinator. If the sleep coordinator is not known, any node that does not have the non-sleep coordinator sleep option bit set, can be used.
When changes are made to a node's sleep parameters, that node will become the network's sleep coordinator (unless it has the non-sleep coordinator option selected) and will send a sync message with the new sleep settings to the entire network at the beginning of the next wake cycle. The network will immediately begin using the new sleep parameters after this sync is sent.
Changing sleep parameters increases the chances that nodes will lose sync. If a node does not receive the sync message with the new sleep settings, it will continue to operate on its old settings. To minimize the risk of a node losing sync and to facilitate the resyncing of a node that does lose sync, the following precautions can be taken:
    1.
    Whenever possible, avoid changing sleep parameters.
    2.
    Enable the missed sync early wake up sleep option (SO). This command is used to tell a node to wake up progressively earlier based on the number of cycles it has gone without receiving a sync. This will increase the probability that the unsynced node will be awake when the network wakes up and sends the sync message.
    3.
    When changing between two sets of sleep settings, choose settings so that the wake periods of the two sleep settings will happen at the same time. In other words, try to satisfy the following equation: (SP1 + ST1) = N * (SP2 + ST2), where SP1/ST1 and SP2/ST2 are the desired sleep settings and N is an integer.
Using this sleep option increases reliability but may decrease battery life.
Figure : Sleep setting examples

Rejoining nodes which have lost sync

It is recommended to build the network with redundant mesh nodes to increase robustness. If a scenario exists such that the only route connecting a subnet to the rest of the network depends on a single node and that node fails, then multiple subnets may arise while using the same wake/sleep intervals. When this occurs the first task is to repair, replace, and strengthen the weak link with new and/or redundant modules to fix the problem and prevent it from occurring in the future. Subnets can drift out of phase with each other if the network is configured in one of the following ways:
    If multiple modules in the network have had the non-sleep coordinator sleep option bit disabled and are thus eligible to be nominated as a sleep coordinator.
    If the modules in the network are not using the auto early wake-up sleep option.
If a network has multiple subnets that have drifted out of phase with each other, get the subnets back in phase with the following steps:
    1.
    Reset the out-of-sync node and set its sleep mode to cyclic sleep. Set it up to have a short sleep cycle.
    2.
    Place the node in range of a sleep support node or wake a sleeping node.
    3.
    Wait for the subnet's next wake cycle. During this cycle, the node selected to change the sleep cycle parameters will send the new settings to the entire subnet it is in range of, including the sleep support node which is in range of the other subnet.
    4.
    Wait for the out-of-sync subnet to wake up and send a sync. When the sleep support node receives this sync, it will reject it and send a sync to the subnet with the new sleep settings.
    5.
    The subnets will now be in sync. The sleep support node can be removed. If desired, the sleep cycle settings can be changed back to what they were.
In the case that only a few nodes need to be replaced, this method can also be used:
    1.
    Reset the out-of-sync node and set its sleep mode to cyclic sleep. Set it up to have a short sleep cycle.
    2.
    Place the node in range of a sleep support node or wake a sleeping node.
    3.
    The out-of-sync node will receive a sync from the node which is synchronized to the network and sync to the network sleep settings.
Last modified 1yr ago