Thursday, January 24, 2013

Monte Carlo simulation for deployment of a WSN

Monte carlo simulation based on random sampling to acquire numerical results. Steps of method: define a domain of inputs, generate inputs randomly, perform a deterministic computation and associate the results. Here an example of Monte Carlo simulation for deployment of a WSN. Assume a uniform random process governs the deployment of network. Assume disk sensing model. Assume that the deployment is done on 100m by 100m square 2D region. Example program that Monte Carlo simulation to find out the necessary number for 99% sensing coverage as a function of sensing radius.
import random
import math

def sensor_location(n):
    coordinates = []
    for i in range(n): 
        x = random.uniform(0,100)
        y = random.uniform(0,100)
        coordinates.append((x,y))
    return coordinates

def coverage_ratio(sample_count,sensor,radius):
    count = 0
    location = sensor_location(sensor)
    for i in range(sample_count):
        xi = random.uniform(0,100)
        yi = random.uniform(0,100)
        sensed = False
        for j in location:
            d = math.sqrt( math.pow((xi-j[0]),2)+ math.pow((yi-j[1]),2))
            if d <= radius:
                sensed = True
                break
        if sensed == False:
            count += 1
     '''
        coverage indicates non-sensed area
     '''
     coverage = ((count/float(sample_count))*10000)
     return 100-(coverage/100) 

def simulation(sample, sensor, radius):
    print "running for radius = %d" % radius
    while True:
        ratio = coverage_ratio(sample,sensor,radius)
        if ratio >= 99.0:
            print "number of required sensor: %d" % sensor
            print "coverage: %f" % ratio
            break
        else:
            sensor+=5
    return ratio

'''perform simulation for 
   initial sensor = 10
   and r = 5 m 
'''
def main():
    simulation(10000,10,5)
 
if __name__ == "__main__":
 main()

After 15 times running the program, the simulation result shows the average necessary sensor number for 99% sensing coverage is 586.73.

Saturday, January 12, 2013

An overview of routing protocols classification in WSNs.

In general, routing protocols can be divided into three groups depending on different network protocol specifications. First, depending on the network structure that the class consists of three routing types are flat-based routing, hierarchical-based routing, and location-based routing.

  • All nodes are typically assigned equal roles of functionality points to flat routing, 
  • Nodes will play different roles in the network points to hierarchical routing, 
  • Sensor nodes’ positions are exploited to route data in the network points to location-based routing. 

Second, depending on how the source finds a route to the destination that the class consists of three routing protocol types is proactive, reactive and hybrid protocols.

  • In proactive protocols, all routes are computed before they are needed,
  • In reactive protocols, routes are computed on demand, 
  • Hybrid protocols use a combination of these two ideas. 

Finally, depending on protocol operation that the class consists of five routing techniques.

  • Multi path-based uses multiple routes simultaneously. 
  • Query-based that the destination node sends a query data from a node to through the network and target node sends the data back to the sender node that initiated the query. 
  • Negotiation-based eliminates redundant data transmissions through negotiation in other terms negotiates data transfers before they occurs. 
  • QoS-based that the network should to balance between energy consumption and data quality. In details, the network has to satisfy certain QoS metrics such as delay, energy, and bandwidth.
  • Coherent-based routing performs only minimum amount of in-network processing. 




Reference: K.Akkaya, M.Younis, ”A Survey of Routing Protocols in Wireless Sensor Networks,” Elsevier Ad Hoc Network Journal, Vol. 3/3 pp. 325- 349, 2005.