# A Novel Self-Forming Virtual Sub-Nets Based Cross-Layer MAC Protocol for Multihop Tactical Network
## 4 Working of Algorithm
Output: TRANS_table of \(N_{i}\) Initialization:\(TRANS\_table\leftarrow\phi\), \(Slot\_no\gets 1\) while(ctrl_slots == true)do
5 if(slot_no == \(MAC\_ID\) && \(N_{i}==source\_node\))then
6 Add transmission in TRANS_table of \(N_{i}\) \(N_{i}\) sends REQ packet with \(M\) unshared transmissions of its TRANS_table  end if
7 if(slot_no == \(MAC\_ID\) && \(N_{j}==TX\)node)then
8 // It is a relay node if(REQ of the transmission has already received)then
9 \(N_{j}\) sends REQ packet to \(N_{k}\) with \(M\) unshared transmissions of TRANS_table  end if
10 \(N_{j}\) sends BRDCST packet with \(M\) unshared transmissions of TRANS_table  end if
11 **else if(\(N_{j}== destination\ node\ ||\ RX\ node\))then**
12 Receives REQ packet of \(N_{i}\) and sends REQ_ACK to \(N_{i}\)  Insert TX and RX in TRANS_table of \(N_{j}\)  Update NBR_table of \(N_{j}\)  end if
13 **end**
14 end if
15 // Virtual sub-nets formation
16 **Input:** TRANS_table of nodes. 17 Output: Virtual sub-nets \(S\). 18 while(\(i==U\))do // i and j refer transmissions of the table
19 Add TX(i) and RX(i) in sub-net \(S_{v}\)
20 Search TRANS_table for TX(i)
21 if(TX(i)==TX(j))then
22 Add RX(j) in sub-net \(S_{v}\)
23 if(TX(i)==RX(j))then
24 Add TX(j) in sub-net \(S_{v}\)
25 end if
26 end if
```

**Algorithm 1**Route establishment and sub-nets formation in VSCL-MAC protocol. These virtual sub-nets perform an autonomous selection of the frequency channel. Each member of the sub-net uses the same frequency channel to communicate with each other. This virtual confinement of radios does not make any physical change in network topology; rather, it separates the communication paths between radios. For instance, the sub-nets in Figure 13 represent a valued graph in which SDRs connected with links labeled by the same frequencies are members of the same sub-net, i.e., SDRs \(N_{1},N_{2},N_{3},N_{7}\), and \(N_{9}\) use frequency channel \(f_{1}\), whereas \(N_{4},N_{5}\), and \(N_{6}\) use \(f_{4}\) for data transmission in a data unit. Algorithm 1 describes the working of the control unit for route establishment, maintaining TRANS_table and sub-nets formation that privileges simultaneous collision-free data transmission. After channel selection, all SDRs calculate time slot allocation vectors (TSVs) for each frequency channel. Algorithm 2 steps the time slot scheduling for TX(s) and relay SDRs down; they are identified in the TRANS_table. It first identifies relay SDRs and the TX(s) for their number of occurrences as the transmitter. The allocation starts from the lowest node ID to the highest. If an SDR is the only transmitter and not a relay SDR, then it gets the current slot in the vector, i.e., the sub-net2 members



The allocation policy for relay SDR is different. The algorithm ensures that if the RX of transmission \(i\) and the TX of the transmission \(j\) are the same, then the TX of transmission \(i\) should get the prior slot of the relay SDR, i.e., in sub-net1, \(N_{2}\) has data for \(N_{9}\) that should be sent via \(N_{3}\). However, there is also a transmission in which \(N_{3}\) has data for \(N_{2}\); then, the algorithm schedules the transmission 3\(\rightarrow\)2 before the transmission 2\(\rightarrow\)3. These transmissions can be scheduled interchangeably, as both transmissions have no relation and \(N_{3}\) has its data to transmit to \(N_{2}\), whereas \(N_{2}\) first needs to send it to \(N_{3}\) and then \(N_{3}\) sends it to \(N_{1}\). The resultant TSV1 has the third slot scheduled for transmission 3\(\rightarrow\)1, which carries data of \(N_{2}\). The data slot allocation on each frequency channel is illustrated in Figure 15. The transmission can hold multiple consecutive slots for data transmission, as discussed in the next section. Within allocated time slots of a slot vector, SDRs perform simultaneous data transmissions without disturbing each other's transmissions. The designed methodology makes every node aware of all the transmissions in the network.