User guide

9 / 18
UZL-Testbed User Guide
Foundations of Adaptive Networked Societies of Tiny Artefacts
//------------------------------------------------
// Shawn models and scenario parameters
//------------------------------------------------
// Shawn edge model
String em = "simple";
// Shawn communication model
String cm = "link_probability";
// Shawn transmission model
String tm = "csma";
// File containing the UZL testbed positions and ids
String scenario = "scenario_fronts.xml";
//Set the seed
if( seed > 0 )
shawn.runCommand("random_seed", "action=set seed=" + seed);
// Use the ids of the fronts testbed instead of 0 to 21
shawn.setGlobalVariable("use_tag_ids", "true");
int range = 35;
//Create a new simulation world and set its parameters
shawn.runCommand("prepare_world","edge_model=" + em +
" comm_model=" + cm + " range=" + range + " size_hint=" + range +
" transm_model=" + tm + " bandwidth=16000 csma_type=802.15.4
immediate_delivery=true" + " env_config=" + scenario);
shawn.setGlobalVariable("count","22");
// Load the fronts scenario
shawn.runCommand("load_world", "world_in_file="+scenario+" snapshot=0
processors=isense");
You can run simulations with and without connecting Shawn to iShell. To connect Shawn to iShell use
the ShawnSocketTask as follows.
//------------------------------------------------
// Connection to iShell
//------------------------------------------------
if (connect_to_ishell)
shawn.runCommand("ShawnSocketTask","socket_port=1280
socket_blocking=true");
For each ShawnSocketTask in the JShawn-file open an iShell instance. In iShell, the address has to be
set to localhost and the port to the value set in the JShawn-file (1280 in the example). The Main node
connects iShell to one node. If your iSense application implements the UartPacketHandler interface
and is registered for at least one packet type, the iShell-Messenger-Plugin can send (uart) messages to
this node. Since node 0x94a0 is the gateway node in the UZL-testbed, set “38048” as main node.
The range debug nodes in iShell specifies the set of nodes from which messages will be transmitted to
the iShell. “* means all nodes. “2157, 1549” means nodes 0x87f and 0x60d. They can be set to