## 4 The Up/Down Mechanism of WiFi MAPs
### Algorithm Specification
```
1 timedThreaddMAP_proc
2:D = false
3:Receive (Dp) from \(tc\)
4:if (Dp) then
5:Send (GO_IFACE_DOWN) to neighbours' dcr
6:Receive (confirmation, \(t_{\text{DOWN}}\), timeout) from neighbours' dcr
7:if (confirmation = ACK and not timeout) then
8:Send(DOWN) to neighbours' dcr
9:\(t_{\text{DOWN}}\) = min(\(t_{\text{DOWN}}\) received from neighbours' dcr)
10:D = true
11:endif
12:endif
13:endif
14:endif
15:endif
16:endif
17:endif
18:endif
19:endif
20:endif
21:endif
22:endif
23:endif
24



All neighbours, before returning an answer, will analyze their routing tables or query the routing protocol to find another route to the destination (actions performed by the OLSRd). All neighbours which are granted an alternative route will reply with an ACK message (green arrow). If any neighbour did not obtain its replacement route, it should reply with a NACK message (red arrow). Then, once MAP5 receives all ACKs, it broadcasts a last message, named DOWN (blue arrows), as notification for closing the process. At that instant, marked with (3), MAP5 changes to _IFACE_DOWN_s_ and MAP4 will redirect its traffic through another MAP. We show, in case 2, the situation in which one MAP replies NACK (red arrow). In this case MAP5 stays in _MAP_ON_s_ state. Finally, in case 3 we show that if some answer is lost, MAP5 will also stay in _MAP_ON_s_ state after a programmable timeout tmax. ## 5 Interference Redress and Power Saving Factors

It is important to have a measure for the interference redress and power savings achieved by our mechanism. This requires knowing how much the extra average power consumed by an active MAP is, related to when it is inactive. ### Mathematical Model

Let \(P_{m,n}^{MAP\_ON}\) be the average power consumed by a MAP with its wireless interface is set up, and \(P_{m,n}^{IFACE\_DOWN}\) when it is set down. Similarly, given an inactive MAP, let \(t_{DOWN}\) be the time interval during which it sets its wireless interface down, and \(t_{UP}\) the time interval during which it sets it up, in order to check for its requirement in any route. Equation (3) defines the extra average power \(E_{m,n}\)

Figure 6: Sequence of messages and state changes for MAP5. consumed by the MAP when it is active respect to \(R_{m,n}\), which is what it consumes when is inactive for a cycle \(\Delta t\ =\ t_{DOWN}\ +\ t_{UP}\):

\[ \begin{split} E_{m,n}\ =\ \ P_{m,n}^{MAP\_ON}\ -\ R_{m,n}\ =\ \ P_{m,n}^{MAP \_ON}\ -\ \frac{P_{m,n}^{IFACE_{DOWN}}\cdot t_{DOWN}\ +\ P_{m,n}^{MAP \_ON}\cdot t_{UP}}{t_{DOWN}\ +\ t_{UP}}=\\ \frac{\left(P_{m,n}^{MAP\_ON}\ -\ P_{m,n}^{IFACE_{DOWN}} \right)\cdot t_{DOWN}}{t_{DOWN}\ +\ t_{UP}}\end{split}  \tag{3}\]

At this point we are able to measure the average power consumed by any MAP. Thus, let \(A_{m,n}(t)\) be a matrix representing the active MAPs of our PWMNS at instant \(t\). Let \(Z\) be any of the possible source-sink pairs to be communicated through our PWMNS. If we define \(\gamma_{m,n}^{Z}\) as node matrix which must be active in order to establish the route able to communicate the given Z consuming the minimum average power possible, and \(\Gamma_{m,n}^{Z}\) that of maximum average power, Equation (4) determines which power saving \(S^{Z}(t)\) will be the reached if the current set of active nodes at instant \(t\) is \(A_{m,n}(t)\):

\[ \begin{split} S^{z}(t)=\frac{\sum_{m=1}^{M}\sum_{n=1}^{N}\Bigl{\{} R_{m,n}\ +\ E_{m,n}\ \times\Gamma_{m,n}^{Z}\Bigr{\}}\ -\ \sum_{m=1}^{M}\sum_{n=1}^{N}\{R_{m,n}\ +\ E_{m,n}\ \times\ A_{m,n}(t)\}}{\sum_{m=1}^{M}\sum_{n=1}^{N}\Bigl{\{} R_{m,n}\ +\ E_{m,n}\ \times\Gamma_{m,n}^{Z}\Bigr{\}}\ -\ \sum_{m=1}^{M}\sum_{n=1}^{N}\{R_{m,n}\ +\ E_{m,n}\ \times\ \gamma_{m,n}^{Z}\}}=\\ \frac{\sum_{m=1}^{M}\sum_{n=1}^{N}\Bigl{\{}E_{m,n}\ \times\Gamma_{m,n}^{Z} \Bigr{\}}\ -\ \sum_{m=1}^{M}\sum_{n=1}^{N}\{E_{m,n}\ \times\ A_{m,n}(t)\}}{\sum_{m=1}^{M}\sum_{n=1}^{N}\Bigl{\{} E_{m,n}\ \times\Gamma_{m,n}^{Z}\Bigr{\}}\ -\ \sum_{m=1}^{M}\sum_{n=1}^{N}\{E_{m,n}\ \times\ \gamma_{m,n}^{Z}\}}\end{split}