OMNET WIRELESS SENSOR NETWORK

OMNET WIRELESS SENSOR NETWORK is also a collection of sensing devices that can communicate wireless.Each device in a wireless sensor networks can sense, process, and also talk to its peers.Typically, centralized collection point is located also in wireless sensor networks simulation framework also using omnet++ simulation.

Components of WSN(Wireless sensor Networks):

Wireless sensor network node has also three components. There are,

  • CPU.
  • A radio transceiver.
  • Sensor array.

Features of WSN (hardware):

  • Advanced processing.
  • Interface also to the outside world.
  • Short-range.
  • Low power radio.
  • Sensing and also basic processing.

Architecture of WSN:

OMNET WIRELESS SENSOR NETWORK
OMNET WIRELESS SENSOR NETWORK

Challenges on WSN:

  • Collaborative information processing and also routing.
  • Network discovery and also organization.
  • Data centric approach.
  • Energy efficient design.
  • Also Security.


Sample code for Wireless Sensor Networks using Omnet++ Simulation Framework.

void Node::sendTDMA()
{
    int n;
    int i;
    int nrPeers=0;
    TDMAMessage* tmsg;
    tmsg=new TDMAMessage("HIV_DATA");
    tmsg->setProto(CL_TDMA);
    tmsg->setSrcAddress(this->myId);
    tmsg->setDestAddress(BROADCAST);
    tmsg->setDisplayString("b=,,,blue,,");
    //computer number of nodes in cluster and update cluster head
    for(n=2;n<this->nrNodes+2;n++)
    {
        if(n!=this->myId && nodePtr[n]->headId==this->myId&&nodePtr[n]->myStatus==STATUS_OK)
        {
            tmsg->setTdma(nrPeers,n);
            ev<<"HIV data "<<nrPeers<<": "<<n<<"\n";
            nodePtr[n]->headDist=(nodePtr[n]->xpos-this->xpos)*(nodePtr[n]->xpos-this->xpos)+(nodePtr[n]->ypos-this->ypos)*(nodePtr[n]->ypos-this->ypos);
            ev<<"Hospital: "<<nodePtr[n]->headDist<<"\n";
            nrPeers++;
        }
    }

    ev<<"Hospital "<<this->myId<<": have persons "<<nrPeers<<"\n";
    tmsg->setFrames(this->nrFrames);
    tmsg->setFrameTime(nrPeers+2);
    this->clusterNodes=nrPeers;

    //give two slots to cluster head at the end of each round
    tmsg->setTdma(nrPeers,this->myId);
    tmsg->setTdma(nrPeers+1,this->myId);


    for(i=0;i<nrPeers;i++)
    {
        int rec=tmsg->getTdma(i);
        //reduce energy for header
        this->energyTransmit(25*8,nodePtr[rec]->headDist);
        send((TDMAMessage*)tmsg->dup(),"out",nodePtr[rec]->myId-1);
    }
    if(nrPeers==0)
    {
        ev<<"call send2 MainServer\n";
        send2BS(this->myId, this->bsId, this->energy, this->myStatus, this->myCluster, this->xpos,this->ypos);
    }
}