Init ESDS repository

This commit is contained in:
Loic Guegan 2022-06-09 21:48:32 +02:00
commit c2e6aad09f
106 changed files with 2638 additions and 0 deletions

View file

@ -0,0 +1,16 @@
[t=0.000,src=n0] Send 1 bytes on wlan0
[t=1.000,src=n1] Receive 1 bytes on wlan0
[t=1.000,src=n1] Received: Hello World!
[t=1.000,src=n2] Receive 1 bytes on wlan0
[t=1.000,src=n2] Received: Hello World!
[t=1.000,src=n2] Turned off
[t=1.000,src=n0] Send 1 bytes on wlan0
[t=2.000,src=n1] Receive 1 bytes on wlan0
[t=2.000,src=n1] Received: Hello World!
[t=2.000,src=n2] Turned on
[t=2.000,src=n0] Send 1 bytes on wlan0
[t=2.500,src=n2] Turned off
[t=3.000,src=n1] Receive 1 bytes on wlan0
[t=3.000,src=n1] Received: Hello World!
[t=3.000,src=n2] Turned on
[t=3.000,src=esds] Simulation ends

View file

@ -0,0 +1,29 @@
#!/usr/bin/env python
def receive(node):
##### Simple receive
code, data=node.receive("wlan0")
msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
node.log(msg)
def execute(api):
# Should works for all receivers
receive(api)
if api.node_id == 1:
receive(api) # Should works
else:
api.turn_off()
api.wait(1) # Node 2 should not receive anything during 1s
api.turn_on()
if api.node_id == 1:
receive(api) # Should works
else:
api.wait(0.5) # Check if started communication get cancelled on turning off
api.turn_off() # Node 2 should not receive anything
api.wait(0.5) # Node 2 should not receive anything during 0.5s
api.turn_on()

View file

@ -0,0 +1,6 @@
#!/usr/bin/env python
def execute(api):
api.send("wlan0","Hello World!",1,1)
api.send("wlan0","Hello World!",1,1)
api.send("wlan0","Hello World!",1,1)

View file

@ -0,0 +1,17 @@
#!/usr/bin/env python
# Load ESDS
import sys
sys.path.append("../../")
import esds
import numpy as np
B=np.full((3,3),8)
L=np.full((3,3),0)
s=esds.Simulator(B,L)
s.create_node("sender")
s.create_node("receiver")
s.create_node("receiver")
s.run()