Hi and thank you for your help
this is the .ned file:
package multichannel;
import org.mixim.base.modules.BaseArp;
import org.mixim.base.modules.BaseNetwLayer;
import org.mixim.base.modules.IMobility;
//import org.mixim.modules.application.ieee80211p.TestWaveApplLayer;
import org.mixim.modules.nic.Nic80211p;
module car
{
parameters:
string mobilityType;
@display("bgb=366,359");
gates:
input radioIn;
submodules:
mobility: <mobilityType> like IMobility {
@display("p=332,315");
}
nic: Nic80211p {
@display("p=94,239");
}
applayer: C_TestWaveApplLayer {
@display("p=94,169");
}
connections allowunconnected:
radioIn --> nic.radioIn;
applayer.lowerControlIn <-- nic.upperControlOut;
applayer.lowerControlOut --> nic.upperControlIn;
applayer.lowerLayerIn <-- nic.upperLayerOut;
applayer.lowerLayerOut --> nic.upperLayerIn;
}
the .cc file for application layer is:
#include "TestWaveApplLayer.h"
#include "mobility/traci/TraCIScenarioManager.h"
#include "mobility/traci/TraCIMobility.h"
class C_TestWaveApplLayer : public TestWaveApplLayer
{
public:
virtual void finish();
virtual void handleSelfMsg(cMessage* msg);
};
Define_Module(C_TestWaveApplLayer);
void C_TestWaveApplLayer::handleSelfMsg(cMessage* msg) {
switch (msg->getKind()) {
case SEND_BEACON_EVT: {
sendWSM(prepareWSM("beacon", beaconLengthBits, type_CCH, beaconPriority, 0, -1));
scheduleAt(simTime() + uniform(-0.0005,0.0005)+ par("beaconInterval").doubleValue(), sendBeaconEvt);
break;
}
default: {
if (msg)
DBG << "APP: Error: Got Self Message of unknown kind! Name: " << msg->getName() << endl;
break;
}
}
}
void C_TestWaveApplLayer::finish() {
TestWaveApplLayer::finish();
recordScalar("numberofbeacon", receivedBeacons);
}
then after running the simulation the totalBusyTime for every node is almost half of the simulation time. because the following part of the code in Decider80211p.cc never returns the channel state as idle:
simtime_t Decider80211p::processSignalEnd(AirFrame* msg) {
.
.
//check if channel is idle now
else if (cca(simTime(), frame) == false) {
DBG_D11P << "Channel not yet idle!\n";
}
.
.
.