User Tools

Site Tools


Sidebar

Jump to
AmbientTalk
CRIME
iScheme

crime:sunspot

CrimeSPOT

CRIME has been ported for wireless sensor networks. In this project we have used sunspots, small nodes equipped with sensors and wireless communication. Every node sends events over the network which can be received by one or more nodes within communication range. Writing applications which are driven by external events is significantly different from writing traditional sequential programs or algorithms. When applications are driven by external events, the control flow of these applications is also driven by these events which can trigger at any order and at any moment in time.

In this project we have used CRIME in order to deal with the complexity of composing and deriving meaningful information from a continuous stream of events received from the surrounding. While CRIME has been previously used for the development of context aware applications we have seen that CRIME did not scale for the development such event driven applications. We therefore had to significantly adapt the reasoning engine in order to deal with the transient nature of events.

This project is still under development, as such the documentation can be out of sync with actual implementation.

Repository

The repository for CrimeSPOT is located at:

https://soft.vub.ac.be/svn-gen/projects/stadium/code/CrimeLoociSunspot

The project is developed using Eclipse. You can check the project out using the normal SVN plugin. Make sure that you use the wizard and import the project as a java project.

Configure the built path by selecting the src folder to be included in the built path. Next add all the jars located in the lib folder the project.

Configuration

Like the deployment process of any application for the sunspot deploying CRIME on your sunspots is done in two steps. First the sunspot runtime has to be configured so that it contains all the used libraries. Then the actual application (in this case a CrimeSPOT component) has to be deployed to the sunspot.

SunSPOT SDK

First of all, the SunSPOT “red” sdk has to be installed on every SunSPOT. This can be done using Sun's SPOTManager.

LooCI

As CRIME makes use of the Looci firmware you will have to configure your sunspot runtime in order to include Looci in the sunspot vm. Instructions on how to do this can be found here.

Tutorial notes:

1) Edit ~/.sunspot.properties as explained && flashlibrary all SunSPOTs

2) before “Setting up the deployment environment”, use Sun SPOTManager to: 1. Start Basestation 2. Start Shared Basestation

3) Before “ant host-run”, edit gateway/build.properties: main.class=be.kuleuven.cs.distrinet.wsn.looci.demo.Demo

CrimeSPOT

After installing LooCI, CrimeSPOT also has to be added to the SunSPOT runtime. This can be done in 6 steps:

1. Checkout the CrimeSPOT project from svn

2. Build the project:

$ ant jar-app

3. Move the resulting jar from CrimeSPOT/suite/ to /path/to/sunspot-sdk-red/lib/CRIME.jar

4. Add the CrimeSPOT jar to the SunSPOT libs by editing the spot.library.addin.jars property in ~/sunspot.properties as follows:

spot.library.addin.jars=${sunspot.lib}/multihop_common.jar${path.separator}${sunspot.lib}/transducer_device.jar${path.separator}${sunspot.lib}/LooCI_1.0.0.jar${path.separator}${sunspot.lib}/CRIME.jar

5. Rebuild & reflash the SunSPOT library in /path/to/sunspot-sdk-red:

$ ant library
$ ant flashlibrary (to be repeated for each sunspot, connected via usb)

6. After reflashing the base station, restart it:

$ ant startbasestation
$ ant start-shared-basestation

CrimeSPOT components

A CrimeSPOT component can now be deployed over the air using LooCI's gateway. More information about the gateway can be found here.

Executing the following commands in the gateway suffices for deploying CrimeSPOTComponent.jar on a SunSPOT with MAC XXXX.XXXX.XXXX.XXXX:

# deploy /path/to/the/CrimeSPOTComponent.jar XXXX.XXXX.XXXX.XXXX
> ID
# activate ID XXXX.XXXX.XXXX.XXXX

As can be observed, unlike for LooCI components, it's not required to manually add wirings for CrimeSPOT components. The CrimeSPOT runtime automatically adds toAll&fromAll wirings for:

- the internal CrimeSPOT event types,

- all event types for which an event-fact mapping is installed.

For debugging purposes, the runtime on a SunSPOT can be monitored by connecting the SunSPOT via USB and executing:

$ ant echo
When your sunspot goes into a loop and restarts itself at boot time you can try to perform a new “ant flashlibrary”. This sometimes resolves the problem.

Creating a CrimeSPOT Component

Netbeans

Individual CrimeSPOT components can be created in Netbeans.

Steps:

1. Create a New Project: Sun SPOT Application

2. Extend the abstract CrimeComponent class and give an implementation for:

o execute(): invoked when the component is activated; expressions can be installed via processExpression(String) or registerRule(String,Action)
o all methods invoked from within the interaction rules (cfr. is-operator) && invoke(String,Object[]); the dispatcher method to access these methods

3. Compile the component:

$ ant jar-app

Macro-CrimeSPOT

The network-level dialect

A CrimeSPOT WSN application can be created from the network-level perspective in the Macro-CrimeSPOT dialect.

Examples can be found on https://soft.vub.ac.be/svn-gen/projects/stadium/code/CrimeLoociSunspot/Macro_CRIMESpot/Examples/.

The precompiler

The precompiler for compiling Macro-CrimeSPOT code to node-level component jars can be obtained via SVN:

1. Checkout the Eclipse project from https://soft.vub.ac.be/svn-gen/projects/stadium/code/CrimeLoociSunspot/Macro_CRIMESpot/ & compile.

2. Use edu.vub.crimespot.precompiler.Main to compile a source file

3. The resulting components can be found in Macro_CRIMESpot/components. Their Java code can be further refined, or the jars can be deployed immediately on SunSPOTs.

crime/sunspot.txt · Last modified: 2011/06/02 12:51 by wamerijc