From: couchot Date: Thu, 5 Dec 2013 13:03:36 +0000 (+0100) Subject: quelques modifs X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/desynchronisation-controle.git/commitdiff_plain/120c13fc4faf264d8b1d3e94c4799860de9e3dea?hp=8fb8450d3502fa222259b4af30b97b450e7e6143 quelques modifs --- diff --git a/IWCMC14/SensorNetwork.png b/IWCMC14/SensorNetwork.png index 14bc262..adce44b 100644 Binary files a/IWCMC14/SensorNetwork.png and b/IWCMC14/SensorNetwork.png differ diff --git a/exp_controle_asynchrone/simulMWSN.py b/exp_controle_asynchrone/simulMWSN.py index 43083c4..218ecb7 100644 --- a/exp_controle_asynchrone/simulMWSN.py +++ b/exp_controle_asynchrone/simulMWSN.py @@ -16,7 +16,7 @@ epsilon = 1E-10 vrate = 0.8 p = 0.7 coteCarre = 50 -distanceEmmissionMax = 30 +distanceEmmissionMax = 20 nbiter = 1000 POS = 1 POS_NUL = 2 @@ -59,11 +59,12 @@ def afficheGraph(G,l,tx,ty,sink): img = cv.CreateImage ((tx, ty), 32, 3) cv.Rectangle(img, (0,0),(tx,ty), cv.Scalar(255,255,255), thickness=-1) def px((x,y)): - return(int(tx*x/coteCarre),ty-int(ty*y/coteCarre)) + u = float(tx)/(coteCarre + 2*distanceEmmissionMax) + return(int(distanceEmmissionMax*u + x * u),int(distanceEmmissionMax*u + y * u)) for i in set(range(len(l)))-set([sink]): (x,y) = l[i] pix,piy = px((x,y)) - demx = distanceEmmissionMax*tx/coteCarre + demx = distanceEmmissionMax*tx/(coteCarre+2*distanceEmmissionMax) cv.Circle(img, (pix,piy),demx, cv.Scalar(125,125,125)) for i in set(range(len(l)))-set([sink]): @@ -107,13 +108,13 @@ G.add_weighted_edges_from(lg) #nx.draw(G) #pb.show() -#(G,l) = genereGraph() +(G,l) = genereGraph() N = G.nodes() #V = list(set(sample(N,int(len(N)*vrate)))-set([sink])) V = list(set(N)-set([sink])) source = V print "source",source -#afficheGraph(G,l,500,500,sink) +afficheGraph(G,l,500,500,sink) #nx.draw(G) #pb.show() @@ -121,8 +122,7 @@ print "source",source - - +exit() #print G.edges(data=True) #TODO afficher le graphe et etre sur qu'il est connexe