-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Examples: Add LEACH example simulation
To showcase how protocol can be implemented in simulation setup
- Loading branch information
Showing
3 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see http://www.gnu.org/licenses/. | ||
// | ||
|
||
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 | ||
{ | ||
parameters: | ||
int numNodes; | ||
@display("bgb=200.8119,200.0099;bgg=100,1,grey95"); | ||
@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"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
[General] | ||
network = Leach | ||
|
||
num-rngs = 2 | ||
rng-class = omnetpp::cMersenneTwister | ||
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" |