• No results found

4. Implementing WikiSensing’s Data Management and Collaboration

4.4. Basic Sensor Data Management Components

4.4.1. Organising Sensor Information

Stage 1: Registering an Environment for a sensor

The first mandatory step for registering sensors is to create an environment that the sensor is deployed in. This information (Table 4.1) includes location details, (e.g. name of location, city, street, country, etc.) as well as geographical coordinates (e.g. longitude, latitude, etc.) that can be selected using Google Maps. Moreover information on the nature of the sensors (disposition, exposure, etc.), the sensor network name (if sensor is member of a sensor network) are also recorded.

The users are encouraged to provide a feed or data stream description that contains the type of sensor (e.g. temperature sensor, accelerometers, pollution sensors, GUSTO sensor [22], etc.). The accessibility of the sensor data can be set as private so that it is only visible to the creator or set as public which makes it accessible to any user of WikiSensing.

76

Field Mandatory Domain Description

Sensor identity Yes Number The identity of the sensor

Environment name Yes String The name of the environment that the sensor is deployed

Feed description No String Description of the data streams Location

description

Yes String Description of the deployed location of the sensor

Access right No Boolean Public or private, and private by default Latitude No Float Latitude of the sensor environment Longitude No Float Longitude of the sensor environment Elevation No Float Elevation of the sensor

Exposure No String Whether the sensor is deployed indoor or outdoor

Disposition No String Whether the sensor location is fixed or mobile Domain No String Whether the sensor is physical or virtual Virtual sensor data

persistence

No Boolean Whether the virtual sensor readings are stored or generated dynamically

Sensor network No String The network Identity of the sensor Data stream identity Yes String The identity of the data stream Stream type Yes String The type of attribute that is measured Unit of measure Yes String The measuring unit of the data stream

Table 4.1: The list of fields involved in registering sensors in WikiSensing

Stage 2: Registering the data streams of a sensor

Sensor devices can measure several attributes of an environment and produce multiple data streams. For example, a GUSTO sensor can measure the NO, NO2,

SO2 and ozone air pollutant readings and provide four different data streams. Hence data streams are representations of a physical or virtual sensor that is deployed at some location. The data stream usually contains a sensor type and a unit of

77

Figure 4.4: WikiSensing graphical view of sensor data streams

The measurement units for a data stream can either be selected from a predefined list or can be explicitly specified by a user. When defining a new unit of measurement users are required to provide a conversion function to a base unit. Once an environment (deployed sensor) has been defined and data streams attached to it, data points or measurements can be added. The data point consists of sensor

measurements and time stamps. The users can also automatically connect the

sensor data streams to the system via the web service layer. This is done by obtaining a service reference of the WikiSensing web services and can be done using any programming platform as explained in section 4.4.6. The data stream information can be viewed graphically as illustrated in Figure 4.4.

Data streams Sensor readings in graphical format Environments (Sensors)

78

A Wiki page representation (Figure 4.5) of the sensor is created automatically when sensors are registered. This page contains a description of the sensor environment followed by its details of the data streams.

Figure 4.5: Wiki pages that record the sensor and data stream information The system also automatically links the environment with a page that contains the relevant sensor meta-information (Figure A.1, of Appendix). The Wiki page containing sensor meta-data lists the sensor properties and features that can also be updated by collaborating users. If needed users are able to create new sensor meta-data Wiki pages in case where a matching page does not exist. These

Wiki pages are automatically updated when corresponding information on the

system are modified by the user.

At the bottom of the Wiki page displayed in Figure A.1 in the Appendix, shows a reference to substantiate the information added to the page by the user. In this example the user annotates a GUSTO (Generic Ultraviolet Sensor

Technologies and Observations) sensor by referencing research work [22]. This is

Sensor details

Data stream information Link to meta-data

79

considered good practice to show provenance for the annotations added by users as experienced with other wiki websites such as Wikipedia.

Stage 3: Query sensor the data streams

The following sample query averages readings of a single sensor for a window size of 1 hour. The WIKI_WINDOW query construct indicates a time window to select

sensor measurements within an hour prior to the execution time. This can also be specified using the number of measurements, which selects the preceding records from the current time stamp.

SELECT Average (p.measurement)

FROM Environment e, DataStream d, DataPoint p WHERE e.sensorId = ‘GUSTO_A1’

AND d.sensorType = ‘NO2’ WIKI_WINDOW = 1<h>

Environment and DataStream are relational data tables and DataPoint represents the data from the non-relational database. However the DataPoint is represented as a relational table for the convenience of validating the query (excluding WIKI prefixed constructs) as well as to preserve the SQL like query structure. Moreover explicit SQL joins are not required to obtain the correct data as the joining is implemented in the application middleware.

Stage 4: Registering a sensor network

A sensor network is a group of (usually homogeneous) sensors deployed at multiple locations providing data streams that can be aggregated to obtain a set of combined sensor readings.

Creating a sensor network in WikiSensing involves two main steps. The first step is to register the sensor network by providing the details that are listed in Table 4.2. The second step is to reference the sensor network from member sensor environments using the Sensor Network Id. A Wiki page is automatically created for the sensor network listing its member sensors.

80

Field Mandatory Domain Description

Sensor Network Id Yes Number The identity of the sensor network Sensor Network Name Yes Number The name of the sensor network Description Yes String A description about the sensor network Purpose No String The motivation for creating a sensor

network

Table 4.2: The list of fields to register a sensor network

Stage 5: Registering sensors to a sensor network

Firstly the user has to create the set of sensors individually by repeating the steps (1 to 4) of the functionality in section 4.4.1 specifying the Sensor Network Id. This links the sensors with the sensor network. The relevant sensor network Wiki page is then updated with this information.

Stage 6: Query sensor data in a sensor network

The following sample query aggregates a set of sensors that belong to a particular sensor network.

SELECT Average (p.measurement)

FROM Environment e, Datastream d, DataPoint p WHERE e.sensorNetwork = ‘GUSTO Sensor Network-1’ AND d.sensorType = ‘NO2’

WIKI_WINDOW = 1<h>

Stage 7: Policies for managing historical sensor measurements

There are two policies used in WikiSensing to manage historical data. The first policy maintains historical data in storage until a user specified time period (e.g. 30 days) with a maximum time period of 90 days. The second policy or default policy aggregates (e.g. averages) sensor data after specific time period (e.g. 7 days) and records a single value. Moreover this time period can be specified by the user with a maximum time period of 90 day being set by the system. However the limitation of the second option is that it requires sensor measurement to be in numeric format.

81