Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LEACH routing protocol #929

Draft
wants to merge 45 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2e82c88
Routing: Add LEACH routing protocol
n-jay Dec 6, 2023
67c97be
Examples: Add LEACH example simulation
n-jay Dec 6, 2023
c1d93a6
Add tests for LEACH protocol
n-jay Dec 6, 2023
341edb5
Update license header format
n-jay Jan 6, 2024
8be9a0f
Fix header file paths
n-jay Jan 7, 2024
751bc0f
Remove C++ block from .msg definition
n-jay Jan 7, 2024
052beed
Move codebase under inet::leach namespace
n-jay Jan 8, 2024
0796844
Update enum checks
n-jay Jan 8, 2024
7215b3c
Parameterize network interface name
n-jay Jan 8, 2024
298eff7
Remove unused includes
n-jay Jan 8, 2024
57c36ed
Fix uninitialized variable issue
n-jay Jan 11, 2024
8ba9c25
Amend destructor cancel event opreation
n-jay Jan 11, 2024
ee9c1a9
Update fingerprint test values
n-jay Jan 11, 2024
439032d
Update fingerprint test values
n-jay Jan 11, 2024
9c05df0
Update network interface configuration flow
n-jay Jan 13, 2024
6947423
Add documentation in NED files
n-jay Jan 14, 2024
9dfd520
Delete redundant lines
n-jay Jan 15, 2024
2f6a9b6
Rename network interface variable
n-jay Jan 20, 2024
e2c5cb0
Rename sample LEACH network .ned
n-jay Feb 4, 2024
9ed810b
Update @display coordinates
n-jay Feb 4, 2024
a6aeb1d
Update sample network ini file
n-jay Feb 4, 2024
85481e9
Add documentation for node .ned files
n-jay Feb 4, 2024
bb14ffb
Refactor LEACH routing protocol documentation
n-jay Feb 4, 2024
c73ecae
Add round duration variance parameter to NED
n-jay Feb 8, 2024
8293e22
Update Leach NED parameters
n-jay Feb 15, 2024
e99fabb
Remove unused numNodes variable
n-jay Feb 21, 2024
f04b5be
Update cluster head percentage parameter
n-jay Feb 21, 2024
510b0ca
Update clusterHeadRatio unit in Leach.ned
n-jay Feb 21, 2024
5f04eac
Remove clusterHeadPercentage setting from example ini
n-jay Feb 21, 2024
99e709f
Refactor Leach.cc vectors
n-jay Feb 21, 2024
ad80f49
Add support for configuring wireless interfaces
n-jay Feb 22, 2024
2a7da92
Remove self-message kind
n-jay Feb 22, 2024
8dcc7d5
Add support for configuring wireless interfaces
n-jay Feb 22, 2024
6008a9a
Implement UDP packet transfers
n-jay Mar 7, 2024
f4a4040
Update radio receiver sensitivity and energy detection values
n-jay May 9, 2024
d930310
Merge branch 'master' of https://github.com/inet-framework/inet into …
n-jay Jul 2, 2024
946b456
Join multicast group for wireless interface
n-jay Jul 3, 2024
162a92b
Refactor protocol registration code
n-jay Jul 4, 2024
0770d2d
Add IsotropicScalarBackgroundNoise
n-jay Jul 6, 2024
0c30c54
Implement UDP packet transfers for sending acknowledgement to CH
n-jay Jul 8, 2024
e840295
Implement UDP packet transfers for sending TDMA schedule to NCH
n-jay Jul 8, 2024
4dbb739
Implement UDP packet transfer for sending data from CH to BS
n-jay Jul 8, 2024
a1dc053
Update Base Station code to support UDP packets
n-jay Jul 9, 2024
6c85dee
Fix issues with UDP packet support
n-jay Jul 9, 2024
e04de37
Merge branch 'master' of https://github.com/inet-framework/inet into …
n-jay Jul 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions examples/manetrouting/leach/Leach.ned
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// SPDX-License-Identifier: LGPL-3.0-or-later
//

package inet.examples.manetrouting.leach;

import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;
import inet.node.contract.INetworkNode;
import inet.node.inet.SensorNode;
import inet.physicallayer.wireless.common.contract.packetlevel.IRadioMedium;
import inet.visualizer.contract.IIntegratedVisualizer;
import inet.environment.common.PhysicalEnvironment;

network Leach
n-jay marked this conversation as resolved.
Show resolved Hide resolved
{
parameters:
int numNodes;
@display("bgb=200.8119,200.0099;bgg=100,1,grey95");
n-jay marked this conversation as resolved.
Show resolved Hide resolved
@figure[title](type=label; pos=0,-1; anchor=sw; color=darkblue);

submodules:
configurator: Ipv4NetworkConfigurator {
@display("p=512.39996,181.17");
}
radioMedium: <default("UnitDiskRadioMedium")> like IRadioMedium {
@display("p=512.39996,289.13998");
}
physicalEnvironment: PhysicalEnvironment {
@display("p=512.39996,441.02997");
}
host[numNodes]: <default("WirelessHost")> like INetworkNode {
@display("i=misc/sensor2");
}
baseStation: <default("WirelessHost")> like INetworkNode {
@display("p=50,50;i=misc/sensorgateway");
}
}
4 changes: 4 additions & 0 deletions examples/manetrouting/leach/address.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<config>
<interface hosts="baseStation" names="wlan0" address="10.0.0.1"/>
<interface hosts="**" address="10.x.x.x" netmask="255.x.x.x"/>
</config>
86 changes: 86 additions & 0 deletions examples/manetrouting/leach/omnetpp.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[General]
network = Leach

num-rngs = 2
rng-class = omnetpp::cMersenneTwister
n-jay marked this conversation as resolved.
Show resolved Hide resolved
seed-0-mt= 4900 # used for node layout generation
seed-1-mt = 7 # used for threshold comparison

**.arp.typename = "GlobalArp"

*.radioMedium.typename = "Ieee802154NarrowbandScalarRadioMedium"
*.radioMedium.backgroundNoise.power = -100dBm
*.radioMedium.mediumLimitCache.centerFrequency = 2GHz

*.host*.hasStatus = true
*.visualizer.energyStorageVisualizer.displayEnergyStorages = true

*.configurator.config = xmldoc ("address.xml")

*.baseStation.typename = "LeachBS"
*.host*.typename = "LeachNode"
*.host*.LEACHnode.clusterHeadPercentage = 0.05
*.host*.LEACHnode.numNodes = 100 # set number of nodes to be injected into LEACH module

*.numNodes = 100 #100
*.host*.mobility.typename = "StationaryMobility"
*.host*.mobility.rng-0 = 0 # random number generator mapping

*.host[*].mobility.initFromDisplayString = false

**.constraintAreaMinX = 1m
**.constraintAreaMaxX = 100m
**.constraintAreaMinY = 1m
**.constraintAreaMaxY = 100m

*.host*.wlan[0].typename = "Ieee802154NarrowbandInterface"
*.host*.wlan[0].radio.typename = "ApskScalarRadio"
*.host*.wlan[0].radio.centerFrequency = 2.5GHz # based on TI CC2520
*.host*.wlan[0].radio.bandwidth = 2MHz
*.host*.wlan[0].radio.transmitter.power = 60.5mW # determines communication range - based on CC2520
*.host*.wlan[0].radio.transmitter.preambleDuration = 192us # based on TI CC2520
*.host*.wlan[0].radio.transmitter.headerLength = 6B # based on TI CC2520
*.host*.wlan[0].radio.receiver.sensitivity = -98dBm # based on TI CC2520
*.host*.wlan[0].radio.receiver.energyDetection = -85dBm
*.host*.wlan[0].radio.receiver.snirThreshold = 4dB
*.host*.wlan[0].radio.displayCommunicationRange = true


*.baseStation.wlan[0].typename = "Ieee802154NarrowbandInterface"
*.baseStation.wlan[0].radio.typename = "ApskScalarRadio"
*.baseStation.wlan[0].radio.centerFrequency = 2.5GHz
*.baseStation.wlan[0].radio.bandwidth = 2MHz
*.baseStation.wlan[0].radio.transmitter.power = 60.5mW
*.baseStation.wlan[0].radio.transmitter.preambleDuration = 192us
*.baseStation.wlan[0].radio.transmitter.headerLength = 6B
*.baseStation.wlan[0].radio.receiver.sensitivity = -98dBm
*.baseStation.wlan[0].radio.receiver.energyDetection = -85dBm
*.baseStation.wlan[0].radio.receiver.snirThreshold = 4dB
*.baseStation.wlan[0].radio.displayCommunicationRange = true

*.host*.**.bitrate = 250kbps # based on TI CC2520
*.baseStation.**.bitrate = 250kbps

[Config LeachPower]
extends = General

*.host*.energyStorage.typename = "SimpleCcBattery"
*.host*.energyStorage.nominalCapacity = 7200C # calculated for 2 x AA cells
*.host*.energyStorage.initialCapacity = 7100C
*.host*.energyStorage.nominalVoltage = 1.5V
*.host*.energyStorage.internalResistance = 0.1Ohm

*.host*.wlan[0].radio.energyConsumer.typename = "StateBasedCcEnergyConsumer"
*.host*.wlan[0].radio.energyConsumer.offCurrentConsumption = 0A
*.host*.wlan[0].radio.energyConsumer.switchingCurrentConsumption = 1mA
*.host*.wlan[0].radio.energyConsumer.receiverIdleCurrentConsumption = 18.8mA # based on CC2520
*.host*.wlan[0].radio.energyConsumer.receiverBusyCurrentConsumption = 24.8mA # based on CC2520
*.host*.wlan[0].radio.energyConsumer.receiverReceivingCurrentConsumption = 26.3mA # based on CC2520
*.host*.wlan[0].radio.energyConsumer.transmitterIdleCurrentConsumption = 25.8mA # based on CC2520
*.host*.wlan[0].radio.energyConsumer.transmitterTransmittingCurrentConsumption = 33.6mA # based on CC2520

[Config LeachPathLoss]
extends = General

*.host*.wlan[0].radio.displayInterferenceRange = true
*.radioMedium.pathLoss.typename = "LogNormalShadowing"
19 changes: 19 additions & 0 deletions src/inet/node/leach/LeachBS.ned
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// SPDX-License-Identifier: LGPL-3.0-or-later
//

package inet.node.leach;

import inet.node.inet.AdhocHost;
import inet.routing.leach.LeachBS;

module LeachBS extends AdhocHost {
n-jay marked this conversation as resolved.
Show resolved Hide resolved
submodules:
LeachBS: LeachBS {
@display("p=825,226");
}
connections:
LeachBS.ipOut --> tn.in++;
LeachBS.ipIn <-- tn.out++;

}
19 changes: 19 additions & 0 deletions src/inet/node/leach/LeachNode.ned
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// SPDX-License-Identifier: LGPL-3.0-or-later
//

package inet.node.leach;

import inet.node.inet.AdhocHost;
import inet.routing.leach.Leach;

n-jay marked this conversation as resolved.
Show resolved Hide resolved
module LeachNode extends AdhocHost {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a leach node requires specific settings to be always set, for example in your doc, you state that it works only with the 802.15.4 radio and MAC, plus it is designed to use only a single wireless interface, I would rather set set and fix all those parameters here specializing the LeachNode for a single wireless interface and setting up that interface to be a 802.15.4 radio. This way the user does not have to configure all those parameters manually in the INI file which is error prone. Also the risk running into an error is decreased as you explicitly set the parameters to their proper value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The standard LEACH protocol doesn't specify the protocol for the Physical and MAC layers, however for my implementation I've used 802.15.4 standard that covers those layers as I was simulating a WSN as realistically as possible. Hence the reference to the Texas Instruments CC2520 in the .INI file comments as well.

So I thought it would be best to explicitly showcase which parameters have been set in the simulation .INI file so whoever is using it can customize as needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay. I get this.

submodules:
LeachNode: Leach {
@display("p=825,226");
}
connections:
LeachNode.ipOut --> tn.in++;
LeachNode.ipIn <-- tn.out++;

}
Loading