= TITAN- Tiny Task Networks - Cookbook = This document includes instructions how to install and to run Titan. [[PageOutline(2-3,Table of Contents,inline)]] == Introduction == The Titan (Tiny Task Network) framework offers distributed execution of context recognition algorithms within Wireless Sensor and Actuation Network (WSAN), especially for Body Area Networks (BAN). Instead of transmitting all the raw sensory data to a centralized point for processing, the data is pre-processed on the nodes as far as possible. Thus, only relevant data is sent to the Resource User. Titan provides the following main features: - Service Graph: A dataflow representation to describe context recognition algoritms as a set of connected services. - Mapping routines: Mapping service graphs to existing services (e.g. sensors, actuators, and processing units) in the network. - Network (re-)configuration: Configuration and execution of context recognition algorithms (represented as service graphs) within the network. The framework‘s central component is running on a PC or mobile phone. It organizes and controls the execution of service graphs which are distributed on the mobile phone, body worn devices, and smart objects in the environment of its user. The Titan framework integrates SENSEI’s resource-oriented approach to distributed processing within the sensor islands themselves. Similar to the Execution Manager (EM), Titan is coordinating the execution of a service graph, monitors the executed session and adapts distributed processing in the network topology by reconfiguring sensor nodes within subseconds. Extending the concepts of the Execution Manager to the sensor islands enables to execute and monitor a service graph more locally. The support of local service operation enforces the stability of the execution in case of failure or disconnection. The Titan framework is connected to the SENSEI System as a REP. It implements the RPI and RAI interfaces: RUs (Resource Users) can use the RAI (Resource User Interface) to add, edit, delete, and start/stop service graphs in the Titan framework, whereas the Titan REP itself publishes the available service graphs as resources to the RD (Resource Directory). == Architectural Overview == The Figure below shows the Integration of the Titan framework in the SENSEI system. The framework’s central component is both implemented in Java SE and Java ME (Personal Profile). It runs on every device supporting one of these two Java platforms. It has been tested on a Windows XP/Vista/7 Machine and on a HTC Touch HD running a Windows Mobile 6.1 OS and IBM J9 Java Virtual Machine. The Titan framework supports by now the following types of nodes: wireless sensor nodes running on TinyOS with the CC2420 radio stack (we used TelosB nodes), any device supporting Java ME Personal Profile (Java Titan Node), and Bluetooth sensor nodes using RFCOMM to send the sensor data. [[Image(titan_arch.png, 40%, center)]] Every sensor node in the Titan framework provides certain services (e.g. sensor, actuator, or processing resource). Titan is scanning the network and registering the services of the available nodes in the Titan Service Directory. All context/activity recognition tasks are defined by a service graph in the Titan Service Graph Directory. Titan can start such a recognition task, by mapping the service graph to the available services found in the Titan Services Directory. The Titan framework is integrated as a REP to the SENSEI system. It registers to the SENSEI system as a Resource through the Resource Publish Interface (RPI). A Resource User (RU) can access Titan through the Resource Access Interface (RAI). Depending on the executed service graph, the Resource User receives data from the Titan Framework. == Installation == === Hardware and Software Requirements Installing the Titan requires the following hardware tools and software packages: * A Computer running an OS supporting [http://www.oracle.com/technetwork/java/javase/downloads/index.html Java SE] * Optional: Mobile device supporting [http://java.sun.com/products/personalprofile/ Java ME Personal Profile] * Optional: One or more TelosB Nodes and [http://docs.tinyos.net/index.php/Getting_started#Installing_TinyOS_2.1.1 TinyOS-2.1.1] === Titan Network Manager ==== Set-Up on a PC The Java SE code for the Titan Network Manager is located in the TITAN_Desktop directory (Eclipse project). The Titan Network Manager can be started by the ch.ethz.ee.ife.sensei.titanmanager.rep.REPServerMain::main(String[] args) method. Parameters in this method can be changed to alter the application's behavior. ==== Set-Up on a Mobile Phone supporting Java SE PersonalProfile The Java ME PersonalProfile code for the Titan Network Manager is located in the TITAN_Mobile directory (Eclipse project). The Titan Network Manager can be started by the ch.ethz.ee.ife.sensei.titanmanager.titan.mobile.TitanMobile::main(String[] args) method. Currently the Java ME version cannot be directly accessed as a Titan REP. Workaround: Set-up a Titan Network Manager on a PC and connect the Java ME version as a "Titan Node Manager" (see below: "Titan Nodes"). === Titan Node Manager A Titan Node Manager hosts a number of Titan Nodes (see below) and is connected to the Titan Network Manager through a TCP/IP connection. A Titan Node Manager is addressed by a subnet-ID (e.g. ID=1, ID=0 is reserved for the Titan Network Manager), whereas Titan Nodes are addressed by the manager's subnet-ID and thier local ID (e.g. a Titan Node in the subnet 2 and with local ID 100 has a global address 2100). ==== Set-Up a Framework with Titan Node Manager 1. - in Java SE: set the ''m_NodeManagerID'' variable located in the ch.ethz.ee.ife.sensei.titannodemanager.TitanNodeManagerMain::main(String[] args) method to the corresponding sub-net ID. Start the Node Manager by this method. - in Java ME: start the application by the ch.ethz.ee.ife.sensei.titanmanager.titan.mobile.TitanMobile::main(String[] args) method. In the GUI start the router with the corresponding sub-net ID. 2. Titan Network Manager: put the hostname of the Titan Node Manager in the ''TitanNodeManager_HostNames'' located in the method ch.ethz.ee.ife.sensei.titanmanager.titan.mobile.TitanMobile::main(String[] args) and start the Network Manager. === Installing the Nodes ==== TelosB Sensor Nodes At least two TelosB nodes are needed. One of the sensor nodes will be connected via USB to the machine running the Titan Network Manager and will act as the communication interface for the Titan Network Manager (Titan Communication Node). The other nodes are used as service provider for the Titan Framework. Every node gets an ID which is defined during compilation time. ID 0 is reserved for the Titan Communication Node. The software implementing Titan in TinyOS-2.1. for the TelosB sensor platform is located in the TITAN/TELOSB directory. Please change to this directory. In the file ''TitanInternal.h'' you can define the communication channel in which the network is working: {{{ #define TITAN_COMM_CHANNEL CC2420_DEF_CHANNEL }}} Compile the code with the following command: {{{ make telosb }}} Now plug-in one of the nodes to the USB port. With the TinyOS command ''motelist'' you should be able to see the connected sensor node: {{{ Reference CommPort Description ---------- ---------- ---------------------------------------- M4A6J3WH /dev/ttyUSB0 tmote sky }}} We want now to install TITAN on the TelosB platform with the ID 0, to create the TITAN Communication Node. {{{ make telosb reinstall. bsl,/dev/ }}} where '''' is in this case ''0'', and '''''' the CommPort of the pluged-in device (use ''motelist''). Repeat the last step to install TITAN on the other nodes. Increase the ID number for every additional node (IDs must be unique!). To run the Titan Network Manager with TelosB support: - Connect the Titan Communication Node to the machine, on which the TITAN Network Manager should run. - Edit following parameters in the code of the class ch.ethz.ee.ife.sensei.titanmanager.rep.REPServerMain: {{{ TitanConnector.m_tmote=true; TitanConnector.m_tmote_comport=; }}} ==== Titan Nodes Titan Nodes are virtual nodes running on a Java SE VM or Java ME PersonalProfile VM. Similar to the TelosB Sensor nodes, they provide services (e.g. sensors, actuators, or processing resources) for the SENSEI framework. Titan Nodes are hosted by the "Titan Network Manager" or by a "Titan Node Manager". The number of created nodes can be set before starting the Network Manager/Node Manager (see parameter ''m_node_nr'' in the corresponding main method).The nodes will get ID 100,101,... ==== Bluetooth Sensor Nodes Bluetooth Sensors using the RFCOMM protocol to send their sensory data can be connected to the Titan framework. Use the ''BTSensor'' service provided by a Titan Node to get the data of a bluetooth sensor into the framework. == Test the TITAN Framewok== To test the framework you can use the ResourceUser-Client GUI located in the TitanDesktop Eclipse-Project: ch.ethz.ee.ife.sensei.titanresourceuser.TitanResourceUserMain. Start the TitanREP on a PC or mobile device as described above and run the RU-Client GUI. - Browse the TitanREP: Use the RU-Client to browse the TitanREP. All available service graphs (acting as SENSEI Resources) can be shown. - Edit service graphs: A RU can edit/add/delete service graphs from the TitanREP. - Start/Stop a service graph: A service graph can be started and stopped by a RU. RU's can subscribe to a running service graph to be notified of the results. Currently TITAN supports no parallel execution of service graphs. You can test the framework with the examples given in the path ''TITAN_Desktop\RUClient\xml\ServiceGraph_descriptions''