Skip to content

Commit 67c97be

Browse files
committed
Examples: Add LEACH example simulation
To showcase how protocol can be implemented in simulation setup
1 parent 2e82c88 commit 67c97be

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//
2+
// This program is free software: you can redistribute it and/or modify
3+
// it under the terms of the GNU Lesser General Public License as published by
4+
// the Free Software Foundation, either version 3 of the License, or
5+
// (at your option) any later version.
6+
//
7+
// This program is distributed in the hope that it will be useful,
8+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
// GNU Lesser General Public License for more details.
11+
//
12+
// You should have received a copy of the GNU Lesser General Public License
13+
// along with this program. If not, see http://www.gnu.org/licenses/.
14+
//
15+
16+
package inet.examples.manetrouting.leach;
17+
18+
import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;
19+
import inet.node.contract.INetworkNode;
20+
import inet.node.inet.SensorNode;
21+
import inet.physicallayer.wireless.common.contract.packetlevel.IRadioMedium;
22+
import inet.visualizer.contract.IIntegratedVisualizer;
23+
import inet.environment.common.PhysicalEnvironment;
24+
25+
network Leach
26+
{
27+
parameters:
28+
int numNodes;
29+
@display("bgb=200.8119,200.0099;bgg=100,1,grey95");
30+
@figure[title](type=label; pos=0,-1; anchor=sw; color=darkblue);
31+
32+
submodules:
33+
configurator: Ipv4NetworkConfigurator {
34+
@display("p=512.39996,181.17");
35+
}
36+
radioMedium: <default("UnitDiskRadioMedium")> like IRadioMedium {
37+
@display("p=512.39996,289.13998");
38+
}
39+
physicalEnvironment: PhysicalEnvironment {
40+
@display("p=512.39996,441.02997");
41+
}
42+
host[numNodes]: <default("WirelessHost")> like INetworkNode {
43+
@display("i=misc/sensor2");
44+
}
45+
baseStation: <default("WirelessHost")> like INetworkNode {
46+
@display("p=50,50;i=misc/sensorgateway");
47+
}
48+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<config>
2+
<interface hosts="baseStation" names="wlan0" address="10.0.0.1"/>
3+
<interface hosts="**" address="10.x.x.x" netmask="255.x.x.x"/>
4+
</config>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
[General]
2+
network = Leach
3+
4+
num-rngs = 2
5+
rng-class = omnetpp::cMersenneTwister
6+
seed-0-mt= 4900 # used for node layout generation
7+
seed-1-mt = 7 # used for threshold comparison
8+
9+
**.arp.typename = "GlobalArp"
10+
11+
*.radioMedium.typename = "Ieee802154NarrowbandScalarRadioMedium"
12+
*.radioMedium.backgroundNoise.power = -100dBm
13+
*.radioMedium.mediumLimitCache.centerFrequency = 2GHz
14+
15+
*.host*.hasStatus = true
16+
*.visualizer.energyStorageVisualizer.displayEnergyStorages = true
17+
18+
*.configurator.config = xmldoc ("address.xml")
19+
20+
*.baseStation.typename = "LeachBS"
21+
*.host*.typename = "LeachNode"
22+
*.host*.LEACHnode.clusterHeadPercentage = 0.05
23+
*.host*.LEACHnode.numNodes = 100 # set number of nodes to be injected into LEACH module
24+
25+
*.numNodes = 100 #100
26+
*.host*.mobility.typename = "StationaryMobility"
27+
*.host*.mobility.rng-0 = 0 # random number generator mapping
28+
29+
*.host[*].mobility.initFromDisplayString = false
30+
31+
**.constraintAreaMinX = 1m
32+
**.constraintAreaMaxX = 100m
33+
**.constraintAreaMinY = 1m
34+
**.constraintAreaMaxY = 100m
35+
36+
*.host*.wlan[0].typename = "Ieee802154NarrowbandInterface"
37+
*.host*.wlan[0].radio.typename = "ApskScalarRadio"
38+
*.host*.wlan[0].radio.centerFrequency = 2.5GHz # based on TI CC2520
39+
*.host*.wlan[0].radio.bandwidth = 2MHz
40+
*.host*.wlan[0].radio.transmitter.power = 60.5mW # determines communication range - based on CC2520
41+
*.host*.wlan[0].radio.transmitter.preambleDuration = 192us # based on TI CC2520
42+
*.host*.wlan[0].radio.transmitter.headerLength = 6B # based on TI CC2520
43+
*.host*.wlan[0].radio.receiver.sensitivity = -98dBm # based on TI CC2520
44+
*.host*.wlan[0].radio.receiver.energyDetection = -85dBm
45+
*.host*.wlan[0].radio.receiver.snirThreshold = 4dB
46+
*.host*.wlan[0].radio.displayCommunicationRange = true
47+
48+
49+
*.baseStation.wlan[0].typename = "Ieee802154NarrowbandInterface"
50+
*.baseStation.wlan[0].radio.typename = "ApskScalarRadio"
51+
*.baseStation.wlan[0].radio.centerFrequency = 2.5GHz
52+
*.baseStation.wlan[0].radio.bandwidth = 2MHz
53+
*.baseStation.wlan[0].radio.transmitter.power = 60.5mW
54+
*.baseStation.wlan[0].radio.transmitter.preambleDuration = 192us
55+
*.baseStation.wlan[0].radio.transmitter.headerLength = 6B
56+
*.baseStation.wlan[0].radio.receiver.sensitivity = -98dBm
57+
*.baseStation.wlan[0].radio.receiver.energyDetection = -85dBm
58+
*.baseStation.wlan[0].radio.receiver.snirThreshold = 4dB
59+
*.baseStation.wlan[0].radio.displayCommunicationRange = true
60+
61+
*.host*.**.bitrate = 250kbps # based on TI CC2520
62+
*.baseStation.**.bitrate = 250kbps
63+
64+
[Config LeachPower]
65+
extends = General
66+
67+
*.host*.energyStorage.typename = "SimpleCcBattery"
68+
*.host*.energyStorage.nominalCapacity = 7200C # calculated for 2 x AA cells
69+
*.host*.energyStorage.initialCapacity = 7100C
70+
*.host*.energyStorage.nominalVoltage = 1.5V
71+
*.host*.energyStorage.internalResistance = 0.1Ohm
72+
73+
*.host*.wlan[0].radio.energyConsumer.typename = "StateBasedCcEnergyConsumer"
74+
*.host*.wlan[0].radio.energyConsumer.offCurrentConsumption = 0A
75+
*.host*.wlan[0].radio.energyConsumer.switchingCurrentConsumption = 1mA
76+
*.host*.wlan[0].radio.energyConsumer.receiverIdleCurrentConsumption = 18.8mA # based on CC2520
77+
*.host*.wlan[0].radio.energyConsumer.receiverBusyCurrentConsumption = 24.8mA # based on CC2520
78+
*.host*.wlan[0].radio.energyConsumer.receiverReceivingCurrentConsumption = 26.3mA # based on CC2520
79+
*.host*.wlan[0].radio.energyConsumer.transmitterIdleCurrentConsumption = 25.8mA # based on CC2520
80+
*.host*.wlan[0].radio.energyConsumer.transmitterTransmittingCurrentConsumption = 33.6mA # based on CC2520
81+
82+
[Config LeachPathLoss]
83+
extends = General
84+
85+
*.host*.wlan[0].radio.displayInterferenceRange = true
86+
*.radioMedium.pathLoss.typename = "LogNormalShadowing"

0 commit comments

Comments
 (0)