## 4 Experimental Design
### Experiment Implementation
#### 4.2.3 Communication Behavior
The model uses the following equation:

\[P_{r}=\frac{P_{\mathrm{r}}G_{\mathrm{r}}G_{\mathrm{r}}x^{2}}{(4\pi d)^{2}L}, \tag{5}\]
```
1.WifiHelper wifi;
2.wifi.SetStandard(WIFI_PHY_STANDARD_80211b);
3.YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
4.wifiPhy.Set(\"RxGain\",DoubleValue(0));
5.wifiPhy.SetPcapDataLinkType(YansWifiPhyHelper::DLT_IEEE802_11_RADIO);
6.YansWifiChannelHelper wifiChannel;
7.wifiChannel.SetPropagationDelay(\"ns3::ConstantSpeedPropagationDelayModel\");
8./wifiChannel.AddPropagationLoss(\"ns3::FriisPropagationLossModel\");
9.wifiChannel.AddPropagationLoss(\"ns3::RangePropagationLossModel\",\"MaxRange\", DoubleValue (50));
10.wifiPhy.SetChannel(wifiChann.Create());
11.NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
12.wifi.SetRemoteStationManager (\"ns3::ConstantRateWifiManager\", \"DataMode\",StringValue (phyMode), \"ControlMode\",StringValue (phyMode));
13.wifiMac.SetType (\"ns3::AdhocWifiMac\");
14.NetDeviceContainer walkerDevices = wifi.Install (wifiPhy, wifiMac, walkerNodes);
15.NetDeviceContainer vehicleDevices = wifi.Install (wifiPhy, wifiMac, vehicleNodes);
16.NetDeviceContainer immobileDevices = wifi.Install(wifiPhy, wifiMac, immobileNodes); //Assigning Networks to Nodes
17.InternetStackHelper internet;
18.internet.Install (walkerNodes);
19.internet.Install (vehicleNodes);
20.internet.Install (immobileNodes);
21.Ipv4 AddressHelper ipv4;
22.NS_LOG_INFO (\"Assign IP Addresses.\");
23.ipv4.SetBase(\"10.1.1.0,\"255.255.255.0);
24.Ipv4 InterfaceContainer iWalk = ipv4.Assign (walkerDevices);
25.ipv4.SetBase(10.1.2.0,\"255.255.0\");
26.Ipv4 InterfaceContainer iVehi = ipv4.Assign (vehicleDevices);
27.Ipv4 InterfaceContainer iImmo = ipv4.Assign (immobileDevices);
```
**Algorithm 6** Scenario Configuration

Where \(P_{r}\) is the reception power; \(P_{t}\) is the transmission power; \(G_{t}\) is the transmission gain; \(G_{r}\) is the reception gain; \(\lambda\) is the wavelength \(d\); is the distance between transmitter and receiver (m); and \(L\) is the system loss. The \(\lambda\) value is commonly calculated as \(C/f\), where \(C=299792458\) m/s (the speed of light in a vacuum); and \(f\) is the frequency (Hz), which can be configured by the user via the Frequency attribute. However, the Friis model is valid only for propagation in free space within the so-called far field region, which can be considered as approximately the region for \(d>3\lambda\). The model will still return a value for \(d>3\lambda\), as doing so (rather than triggering a fatal error) is practical for many simulation scenarios. However, we stress that the values obtained in such conditions cannot be considered realistic [39]. Several other propagation models were tested, until finally settling on using a modified version of the maximal range model with a communication threshold of 50 m, representing the maximum communication range of the participant nodes. This propagation model is used in conjunction with a modified random propagation delay model, with a 0.7-second listening threshold to drop packages. Algorithm 6 shows an example of the Wi-Fi channel configuration. Once configured, the network layer must be assigned to the nodes. The InternetStackHelper provides the nodes with IP/TCP/UDP functionality, allowing setting communication capabilities with ease. Note that the model supports different communication channels; however, due to ns-3 limitations, we have focused on using Wi-Fi as the channel of choice, and simulated different channels using different networks. The nodes can either use the same network, or separate networks with common nodes working as links (thus emulating the use of different channels), with a one-hop communication restriction. ```
1. TypeId tid = Typeld::LookupByName (\"ns3::UdpSocketFactory\"); //Assigning Sinks to walker nodes
2.