WIRELESS SENSOR NETWORK SIMULATION USING OMNET

WIRELESS SENSOR NETWORK SIMULATION USING OMNET  is also of Main goal to the long lasting, flexible, and reliable operation to carry in a network communication channels.Also, wireless sensor node consists of sensing, computing, communication, actuation, and also power component.

Characteristics of WSN:

  • It’s an reliable and also to minimize maintenance
  • Energy efficient, so leads also to increase network life time
  • Inexpensive, so that many nodes can also deployed
  • Nodes are small and also cheap
  • Small, also for ease of deployment
  • Nodes have fixed radio range and also a fixed sensing range etc

Architecture of WSN (emergency situation):

WIRELESS SENSOR NETWORK SIMULATION USING OMNET
WIRELESS SENSOR NETWORK SIMULATION USING OMNET

Applications of wireless sensor network:

  • Healthcare applications
  • Warfare
  • Civil engineering
  • Distributed data collection
  • Agricultural monitoring
  • Unobtrusive observation in remote/hard-to-get-to locations
  • Human behavior monitoring etc

Sample Coding for Wireless Sensor Networks using Omnet++

void BS::handleMessage(cMessage* msg) {
    if (msg->isSelfMessage()) {
        if (msg->getKind() == SMSG_INIT) {
            this->initNodes();
        }
    } else {
        if (((ClusterMessage*) msg)->getProto() == CL_TOBS) {

            sender = ((Status2BSMessage*) msg)->getSrcAddress();
            energy = ((Status2BSMessage*) msg)->getEnergy();
            cluster = ((Status2BSMessage*) msg)->getCluster();
            status = ((Status2BSMessage*) msg)->getStatus();
            xpos = ((Status2BSMessage*) msg)->getXpos();
            ypos = ((Status2BSMessage*) msg)->getYpos();
            if (energy < 0 && this->halfDead == 0)
                this->halfDeadCtr++;
            advInfo[sender].id = sender;
            advInfo[sender].energy = energy;
            advInfo[sender].status = status;
            advInfo[sender].xpos = xpos;
            advInfo[sender].ypos = ypos;

            if (advInfo[sender].energy < 0) {
                if (((Node*) nodePtr[sender])->myStatus != STATUS_DEAD)
                    this->deadNodes++;
                advInfo[sender].status = STATUS_DEAD;
                status = STATUS_DEAD;
                ((Node*) nodePtr[sender])->myStatus = STATUS_DEAD;

            }
            rating = energy - roundEnergyLoss;
            advInfo[sender].rating = rating;
            if (this->nrStatusRec == this->nrNodes - this->oldDeadNodes) {
                this->oldDeadNodes += this->deadNodes;
               this->deadRound[this->roundsDone] = this->deadNodes;

                if ((this->halfDeadCtr > (this->nrNodes / 10)) && this->halfDead
                        == 0) {
                    this->halfDead = roundsDone;
                    this->calledEnd = 2;
                    simulation.endRun();
                }
                this->roundsDone++;
                if (this->roundsDone <= this->nrRounds) {
                                        releaseConnections();
                    computeBest();
                    resetStatus();
                }
                if (this->roundsDone > this->nrRounds) {
                    this->calledEnd = 1;                   simulation.endRun();
                }            }        }    }
    delete msg;
}