This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Red_Sensora(object): | |
def __init__(self, figura, ax): | |
self.figura = figura | |
self.ax = ax | |
self.arr_nodos = [] | |
self.arr_aristas = [] | |
#Intrusos | |
self.arr_intrusos = [] | |
self.arr_intrusos_detectados = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Arista_Nodos(object): | |
def __init__(self): | |
self.id = 0 | |
self.x1 = 0 | |
self.x2 = 0 | |
self.y1 = 0 | |
self.y2 = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Nodo_Intruso(object): | |
def __init__(self): | |
self.id = 0 | |
self.x = 0 | |
self.y = 0 | |
self.x = 0 | |
self.arr_trayectoria = [] | |
def crea_nodo_intruso(self): | |
self.x = self.generarRandom() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Nodos(object): | |
def __init__(self): | |
self.nodo = None | |
self.id = 0 | |
self.vida = 5 | |
self.rango = 5 | |
self.x = 0 | |
self.y = 0 | |
self.z = 0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from mpl_toolkits.mplot3d import Axes3D | |
import matplotlib.pyplot as plt | |
import random | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation | |
n_nodos = 13 | |
# colores nodos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def posReceptor(antenas_l, imagen): | |
global receptor | |
posX, posY = receptor | |
d1 = math.sqrt(((posX - antenas_l[0][0])**2) + ((posY - antenas_l[0][1])**2)) #Distancias desde el receptor hasta cada uno de los puntos transmisores | |
d2 = math.sqrt(((posX - antenas_l[1][0])**2) + ((posY - antenas_l[1][1])**2)) | |
d3 = math.sqrt(((posX - antenas_l[2][0])**2) + ((posY - antenas_l[2][1])**2)) | |
x = ((((d1**2 - d2**2) + (antenas_l[1][0]**2 - antenas_l[0][0]**2) + (antenas_l[1][1]**2 - antenas_l[0][1]**2)) * (2*antenas_l[2][1]-2*antenas_l[1][1])) - (((d2**2 - d3**2) + (antenas_l[2][0]**2 - antenas_l[1][0]**2) + (antenas_l[2][1]**2 - antenas_l[1][1]**2)) * (2*antenas_l[1][1]-2*antenas_l[0][1]))) / (((2*antenas_l[1][0]-2*antenas_l[2][0])*(2*antenas_l[1][1]-2*antenas_l[0][1]))-((2*antenas_l[0][0] - 2*antenas_l[1][0]) * (2*antenas_l[2][1]-2*antenas_l[1][1]))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def antenas(): | |
global colorsm antenas | |
imagen = Image.new( 'RGB', (500, 500), "white") | |
x, y = imagen.size | |
antenas_l = [] | |
i = 0 | |
for antena in antenas: | |
draw = ImageDraw.Draw(imagen) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set INCREMENT 0.2 | |
set PacketSize_ 1024 | |
proc check {} { | |
global cbr1 cbr0 ns nf | |
global INCREMENT | |
set cbrBW1 [$cbr0 set ack_] | |
set cbrBW0 [$cbr1 set ack_] | |
set now [$ns now] | |
set d [expr $now - 0.1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image, ImageDraw | |
from sys import argv | |
def gray_scale(img): | |
pixel = img.load() | |
w, h = img.size | |
for i in range(w): | |
for j in range(h): | |
r, g, b = pixel[i,j] | |
media = (r+g+b)/3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##iniciamos | |
set ns [new Simulator] | |
##declaramos el tipo de enrutamiento | |
$ns rtproto LS | |
##archivo para la simulación | |
set nf [open a.nam w] | |
set nt [open trace.tr w] |
NewerOlder