ALOHA SAMPLE CUSTOMIZATION

81 views
Skip to first unread message

michel TSHODI

unread,
Jul 9, 2019, 5:08:23 PM7/9/19
to OMNeT++ Users
Hi everybody!
I am trying to customize the aloha sample by adding some Wifi Laptops to the CellPhones already present.
I have create a .ned file to describe Laptops as the host.ned file contain the cellphones description.
Here is the source code of the files:
The Aloha.ned file
network Aloha
{
    parameters:
        int numHosts;  // number of hosts
        int numLaptop; //number of laptops
        double txRate @unit(bps);  // transmission rate
        double slotTime @unit(ms);  // zero means no slots (pure Aloha)
        @display("bgi=background/terrain,s;bgb=1000,1000");
    submodules:
        server: Server;
        host[numHosts]: Host {
            txRate = txRate;
            slotTime = slotTime;
        }
        laptop[numLaptop]: Laptop {
            txRate = txRate;
            slotTime = slotTime;
        }
        
}
The Laptop .ned file
simple Laptop
{
    parameters:
        @signal[state](type="long");
        @statistic[radioState](source="state"; title="Radio state"; enum="IDLE=0,TRANSMIT=1"; record=vector);
        double txRate @unit(bps);          // transmission rate
        volatile int pkLenBits @unit(b);   // packet length in bits
        volatile double iaTime @unit(s);   // packet interarrival time
        double slotTime @unit(s);          // zero means no slots (pure Aloha)
        double x @unit(m);                 // the x coordinate of the host
        double y @unit(m);                 // the y coordinate of the host
        double idleAnimationSpeed;         // used when there is no packet being transmitted
        double transmissionEdgeAnimationSpeed; // used when the propagation of a first or last bit is visible
        double midTransmissionAnimationSpeed; // used during transmission
        bool controlAnimationSpeed = default(true);
        @display("i=device/wifilaptop");
}

The Host.ned file
simple Host
{
    parameters:
        @signal[state](type="long");
        @statistic[radioState](source="state"; title="Radio state"; enum="IDLE=0,TRANSMIT=1"; record=vector);
        double txRate @unit(bps);          // transmission rate
        volatile int pkLenBits @unit(b);   // packet length in bits
        volatile double iaTime @unit(s);   // packet interarrival time
        double slotTime @unit(s);          // zero means no slots (pure Aloha)
        double x @unit(m);                 // the x coordinate of the host
        double y @unit(m);                 // the y coordinate of the host
        double idleAnimationSpeed;         // used when there is no packet being transmitted
        double transmissionEdgeAnimationSpeed; // used when the propagation of a first or last bit is visible
        double midTransmissionAnimationSpeed; // used during transmission
        bool controlAnimationSpeed = default(true);
        @display("i=device/cellphone");
}

And the omnet.ini file
[General]
network = Aloha
#debug-on-errors = true
#record-eventlog = true
Aloha.numHosts = 20
Aloha.numLaptop = 20
Aloha.slotTime = 0    # no slots
Aloha.txRate = 9.6kbps
Aloha.host[*].pkLenBits = 952b #=119 bytes, so that (with +1 byte guard) slotTime is a nice round number
Aloha.laptop[*].pkLenBits = 952b
**.x = uniform(0m, 1000m)
**.y = uniform(0m, 1000m)
**.animationHoldTimeOnCollision = 0s
**.idleAnimationSpeed = 1
**.transmissionEdgeAnimationSpeed = 1e-6
**.midTransmissionAnimationSpeed = 1e-1
[Config PureAloha1]
description = "pure Aloha, overloaded"
# too frequent transmissions result in high collision rate and low channel utilization
Aloha.host[*].iaTime = exponential(2s)
Aloha.laptop[*].iaTime = exponential(2s)
[Config PureAloha2]
description = "pure Aloha, optimal load"
# near optimal load, channel utilization is near theoretical maximum 1/2e
Aloha.host[*].iaTime = exponential(6s)
Aloha.laptop[*].iaTime = exponential(6s)
[Config PureAloha3]
description = "pure Aloha, low traffic"
# very low traffic results in channel being idle most of the time
Aloha.host[*].iaTime = exponential(30s)
Aloha.laptop[*].iaTime = exponential(30s)
[Config PureAlohaExperiment]
description = "Channel utilization in the function of packet generation frequency"
repeat = 2
sim-time-limit = 90min
#**.vector-recording = false
Aloha.numHosts = ${numHosts=10,15,20}
Aloha.host[*].iaTime = exponential(${iaMean=1,2,3,4,5..9 step 2}s)
Aloha.numLaptop = ${numLaptop=10,15,20}
Aloha.laptop[*].iaTime = exponential(${iaMeans=1,2,3,4,5..9 step 2}s)
[Config SlottedAloha1]
description = "slotted Aloha, overloaded"
# slotTime = pkLen/txRate = 960/9600 = 0.1s
Aloha.slotTime = 100ms
# too frequent transmissions result in high collision rate and low channel utilization
Aloha.host[*].iaTime = exponential(0.5s)
Aloha.laptop[*].iaTime = exponential(0.5s)
[Config SlottedAloha2]
description = "slotted Aloha, optimal load"
# slotTime = pkLen/txRate = 960/9600 = 0.1s
Aloha.slotTime = 100ms
# near optimal load, channel utilization is near theoretical maximum 1/e
Aloha.host[*].iaTime = exponential(2s)
Aloha.laptop[*].iaTime = exponential(2s)
[Config SlottedAloha3]
description = "slotted Aloha, low traffic"
# slotTime = pkLen/txRate = 960/9600 = 0.1s
Aloha.slotTime = 100ms
# very low traffic results in channel being idle most of the time
Aloha.host[*].iaTime = exponential(20s)
Aloha.laptop[*].iaTime = exponential(20s)

I also want to apply linear mobility on the both kind of devices.
Someone can help, please?

Regards,
ALOHA1.jpg
Reply all
Reply to author
Forward
0 new messages