I am looking for connecting TOSSIM (for TOS 2.x) with "the
real-world". My requirements:
1) simulation time run as constant multiple of real-world time
2) sim-time based events in python
3) simulation packets dispatched via serial-forwarder compatible server.
I am aware that these seem to, for the most part, have TOSSIM (for TOS
1.x) counter-parts, but I have come up empty-handed in searches for
TOSSIM/T2 ways of interacting at this level.
1) Simulation time run as a constant multiple of real-world time
To simplify the case, I'm making the assumption that the simulation
can run faster than real-world time (I know this isn't always true
with an advanced radio noise model, etc.)
My current approach/idea looks something like:
t = Tossim([])
p = t.newPacket(..)
# setup motes, p, etc.
start = time.time()
while 1:
time.sleep(somedelay) # other "real-world" processing occurs here
next = time.time() - start
nextTicks = long(next * t.ticksPerSecond())
p.deliver(0, nextTicks)
while t.time() < nextTicks:
t.runNextEvent()
It's fine if the program busy-loops (by #3, a dedicated machine may be
used), ideally there will be some outside-in event processing happing
at time.sleep(...).
2) Sim-time based events in python.
It is a rather easy task to add event-based dispatching to above. The
events would run relative to simulator time. It would just inject a
packet (force a sim-event) at a given time and then dispatch as needed
(a simple event-dispatch).
I would be interested in better ways of controlling simulation
running. A runUntil(), or adding a truly dummy event, would be nice
(runUntil() is essentially be simulated with dummy packet injections
above.)
3) Simulation packets dispatched to serial-forwarder server
Now, this is where it starts to get hairy.
Is there existing TOSSIM/T2 components to do this?
That is, export packets so that other programs can receive them?
In a simple manner, I could just create a TOSSIM module (say,
AMTossimC) which would invoked a python callback which sent data over
some open TCP server connection. IO could be handled non-blocking in
the time.sleep(...) portion of the code presented above or even
directly in the event (just make sure it isn't cyclic). Instead of a
callback, a buffer (emptied during the time.sleep(...)) could be
employed as well.
By extension, this could use TOSSIM packet injection to put data in
the simulator (inside the simulator, AMTossimC would just unwrap the
special packet as needed using the normal AM component) from a
listening sf-compatible server connection (once again, at
time.sleep(..)).
These are 3 tasks that I'd really like to be able to do in TOSSIM/T2.
I've presented my tentative approaches, but would like feedback as to
if these tasks have already been solved and, if so, how.
(I would really rather use an already made configuration/module if it
fits my criteria).
Or, just if these ideas are worth pursuing.
Also, if anyone knows of good links to this stuff... I've scoured the
howtos/wikis/papers I could find, but anything relevant seems to be
tied to TOSSIM for TOS 1.x (which is not an option).
Thanks in advance,
Paul
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help