mirror of
https://gitlab.com/manzerbredes/esds.git
synced 2025-06-08 14:27:39 +00:00
Init ESDS repository
This commit is contained in:
commit
c2e6aad09f
106 changed files with 2638 additions and 0 deletions
16
tests/simple_send_wlan0_1s2r/out
Normal file
16
tests/simple_send_wlan0_1s2r/out
Normal 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
|
29
tests/simple_send_wlan0_1s2r/receiver.py
Normal file
29
tests/simple_send_wlan0_1s2r/receiver.py
Normal 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()
|
||||
|
6
tests/simple_send_wlan0_1s2r/sender.py
Normal file
6
tests/simple_send_wlan0_1s2r/sender.py
Normal 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)
|
17
tests/simple_send_wlan0_1s2r/simulator.py
Executable file
17
tests/simple_send_wlan0_1s2r/simulator.py
Executable 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()
|
Loading…
Add table
Add a link
Reference in a new issue