new_k = 4
    return new_k


enable_main = 1
if enable_main:

    def main():
        rssi_level = sys.argv[1]
        return {'y0': rssi_level}

    rssi_level = int(main()['y0'])
else:
    rssi_level = -20

t = Tossim([])
t.addChannel('printf', sys.stdout)
t.addChannel("DataFeedback", sys.stdout)
r = t.radio()

# offline network topology initialization to make 1-DR = p_1*d^2+p_2*d^2+p_3
#print "linkError: ", str(rssi_linkError[rssi_level])
#subprocess.call(["a.out", str(rssi_linkError[rssi_level])])


def initialize_network():

    # this is topology for channel 26
    f = open("topo.txt", "r")

    #wireless rssi topology injection & model establishment
Exemple #2
0
from simx.base.testutil import import_assert_functions
import_assert_functions(globals())

import random, time

from TOSSIM import Tossim
from SimxSync import SimxSync

from simx.sync import TimeControl

_tossim = Tossim([])
_sync = SimxSync()
control = None


def advance_some_time():
    # advance time some each time
    boot_time = _tossim.time() + random.randint(17, 42)
    node = _tossim.getNode(0)
    node.bootAtTime(boot_time)
    while _tossim.time() < boot_time:
        _tossim.runNextEvent()


def setUp():
    global control
    control = TimeControl(_tossim, _sync)
    advance_some_time()


def test_advance_some_time():