Professional Documents
Culture Documents
COMMON-Sense Net Low-Level System Design (Phase 1) : Jacques Panchard (EPFL)
COMMON-Sense Net Low-Level System Design (Phase 1) : Jacques Panchard (EPFL)
COMMON-Sense Net Low-Level System Design (Phase 1) : Jacques Panchard (EPFL)
Ref.: CS-HLD-042907
17-1
1 Introduction
This document aims at defining the low-level design for the prototype of COMMONSense Net to be deployed in the field by mid-2005 (first deployment in the lab in January 2005). In order to do that, it is organized along the following lines: Requirements summary Server Subsystems with APIs Embedded modules functional requirements Agenda for all parties involved from November 2004 to January 2005 with action items and milestones.
2 System Requirements
2.1 Information needs
Based on [Rao 2004], the issues most critically at stake in our context (see [Panchard 2004]) are (in each case, the relevant physical parameters are listed): Control of diseases, Yield of crop: soil moisture, temperature, solar radiation, rain falls, air humidity Water availability in bore wells: water pressure (pressure probes mounted as piezometers in the wells)
Ref.: CS-HLD-042907
17-2
Current uses To measure soil parameters for use as inputs for the models and validate soil moisture components of HEURISTIC, APSIM and CROPGRO models (refer Gadgil et al 2002 for cropgro and Prs Rao etal 2004 for apsim) Validate the values used in HEURISTIC model for farming operations and pests and diseases (refer Gadgil et al 1999) To assess / correlate farmers estimates of soil moisture to actual measurements and develop benchmarks for use. Work with farmers and schools to evolve correlation / assessments between rainfall events and soil moisture in different types of soil, crop growth, runoff, storage of runoff in tanks
Potential uses To measure soil moisture in pebble dominant soils and compare with predictions by soil moisture model*
Frequency of reporting Once in 15 minutes during rain, other wise hourly, at near 15 bar level of soil moisture (PWP) the reporting can be stopped
Evolve suitable modifications to the sol moisture models for simulating moisture in such soils
Temperature
Air humidity
Data used to establish relationship between increase in population of pests & pathogens as well as occurrence of physiological disorders(refer table 4 of user needs report) Measurements at coconut tree tops will help to correlation with dew formation** Data used to establish relationship between increase in population of pests & pathogens as well as occurrence of physiological disorders(refer table 4 of user needs report)
1/10 ha in open fields, 2-10 / 10ha for areas with trees and in orchards 3-4/ 10ha 1/10 ha in open fields, 2-10 / 10ha for areas with trees and in orchards 1/500 ha
Ground level
Hourly
Ground level and tree top ground level for field crops + on tree tops in orchards
Rainfall
Ref.: CS-HLD-042907
17-3
For field deployments, it is unlikely that the base station can be connected directly to a PC over a wire, whereas this solution is feasible for the CEDT deployment. A solution consisting of a Wi-Fi connection or a mobile base station (see Luo05) will be investigated. Once the system is installed in the field, the network self-organizes in a tree topology reporting back to the sink (base station) located on the CEDT premises. From the on, the data collection and processing is automated and requires only the operation of a computer-literate operator. The sink (base station) is connected to a PC, comprising a data base where data are written when they are collected and from which they are extracted for display or data processing. A first data processing subsystem should be implemented in order to make some use of the data collected. It is designed in accordance with one or more of the following models HEURISTIC, APSIM or CROPGRO. From the PC, it is possible to draw a view of the network topology and to act on nodes (power level, sampling frequency, sleep/wake-up mode), be it individually or network-wide.
Ref.: CS-HLD-042907
Our system is very static. Once the sensors have been put in place, the topology should not change except for units going down due to accidental destruction or power outage or breakdown. Many or the features required for adhoc mobile networks are not highly relevant to our situation (fast automatic route updates, topology discovery, etc.) As it stands today, motes have a very limited transmission range. That makes it very unlikely that we can transmit directly from the sensor network to a Central Server (PC) as the latter will have to be housed in a safe and convenient location (private residence). We need therefore to look at the possibility to have a mixed network with a Base Station part of the sensor network, located in the field, but with access to some power source. This Base Station will in turn relay the data to the Central Server though another mean like Wi-Fi. Develop internal expertise with regard to low cost sensor development. Adaptive rate at every node: the rate adaptation is centrally driven, but every nodes can raise an alarm when it notices that the data variations increases significantly (in case of rain for soil moisture for instance). Increased range (up to 200m): new antenna design Accuracy of readings: needs to be tested for air humidity, rain gage. The soil moisture data need also to be validated. Integration of new sensors on the probes: air humidity, rain gage. Is an MDA card necessary in this case? This would increase significantly the price of the system. Packaging: rough environment, cable protection etc. Data processing subsystem: the functionalities are still to be defined precisely, and the integration to be done at the server side. Battery life: the network life-time can still be optimized
Ref.: CS-HLD-042907
The default transmission rate is 1 hour for every parameter: soil moisture, temperature, precipitation, air humidity and solar radiation (light). Optional: Nodes store the data with a message counter and the sampling frequency at the time. Nodes send the data with the node id in a multihop fashion to the base station. There is no time stamp added before emission since it is the base station that add the time stamp upon arrival. Base station transmits the data to the application sitting on the PC (front-end). Results of commands are logged into a database. The results in the database can be retrieved for display by the web server, or for processing by the data processing subsystem. Nodes can be added, removed and relocated without further configuration. A route update can be requested from the web interface Parameters like transmission power, sampling frequency can be modified from the web server and downloaded to the network. Commands are sent to the nodes as a broadcast. Nodes periodically inform the front-end of their health status (battery voltage, Received Signal Strength Indicator RSSI - with parent, and/or bit or packet error-rate).
Observer initiated and event driven data models are the best suited to the COMMON-Sense network.
The integration of the probes with the mica2 wireless sensor needs to be solved for the rain gage. This is the object of another design document and is beyond the scope of the present document. For the other probes, the hardware and software tools already exist. All the probes to be used will be tested in their ability to record data with a standard deviation of 5% (temperature, humidity, soil moisture). This number is somewhat arbitrary at the moment, but will be used by default until we get more precise requirements from hydrologists or agronomists involved in the project (HYDRAM, CAOS) However, ways to get by the use of the MDA300 data acquisition board should also be investigated, since it is a very expensive component. This also is the object of an upcoming design document.
3.4 Packaging (to be completed with the help of CEDT and or HYDRAM)
Packaging must be resistant to heavy rain and high temperature and humidity. It must also be protected against unintentional human damage linked with agriculture activity and animal damages (e.g. by using tubes to conceal the probes cables). Guidelines for the package are: A water proof box with small apertures to insure the ventilation of the sensor node (against temperature rise and condensation), disposed so that they prevent the rain to enter the box. A tube to protect the cables of the sensors deployed underground.
Ref.: CS-HLD-042907
17-7
The case of the sensors that are integrated on a sensor-board directly attached to a mote still need to be discussed. In particular, how is it possible to protect a sensor without impacting on the physical data it is collecting (e.g. temperature or air humidity)?
Ref.: CS-HLD-042907
17-8
Ref.: CS-HLD-042907
17-9
CSN_TYPE_GETRATE = 2, CSN_TYPE_SLEEP = 3, CSN_TYPE_WAKEUP = 4, CSN_TYPE_GETPARENT = 5, CSN_TYPE_SETPOWER = 6, CSN_TYPE_GETPOWER = 7, CSN_TYPE_GETROUTING = 8, CSN_TYPE_SETDUTYCYCLE = 9, CSN_TYPE_GETDUTYCYCLE = 10, CSN_TYPE_SETSENSORFLAGS = 11, CSN_TYPE_GETSENSORFLAGS = 12, CSN_TYPE_GETHEALTHSTATUS = 13 };
The sensor flags are used to discriminate between different types of data messages (CSN_TYPE_SENSORREADING in previous enum). Since they can overlap, we define them as bit arrays rather than incrementing integers. It is to be noted that to each type of data (or sensor) corresponds one fixed ADC port (this is used to detect what data to send during the set-up phase, when the node detects which port is active and which is not). The rule is that the SENSOR_BIT defined hereafter is 2 at the power ADC_PORT_NUMBER:
enum { SENSOR_TEMP = 1, SENSOR_HUMID1 = 2, SENSOR_HUMID2 = 4, SENSOR_MOIST1 = 8, SENSOR_MOIST2 = 16, SENSOR_RAIN = 32, SENSOR_TOBEATTRIBUTED1 = 64, SENSOR_TOBEATTRIBUTED2 = 128 };
Some alarms can be raised by the sensor node and notified to the server via the base station:
enum { ALARM_RATE_TEMP = 1, ALARM_RATE_HUMID1 = 2, ALARM_RATE_HUMID2 = 4, ALARM_RATE_MOIST1 = 8, ALARM_RATE_MOIST2 = 16, ALARM_RATE_RAIN = 32, ALARM_VOLTAGE = 64, ALARM_HEALTH_STATUS = 128 ALARM_CONN_TEMP = 256, ALARM_CONN_HUMID1 = 512, ALARM_CONN_HUMID2 = 1024, ALARM_CONN_MOIST1 = 2048, ALARM_CONN_MOIST2 = 4096, ALARM_CONN_RAIN = 9192 };
Ref.: CS-HLD-042907
17-10
uint16_t humid1; uint16_t humid2; uint16_t moist1; uint16_t moist2; uint16_t rain; uint16_t voltage; } __attribute__ ((packed)) CSNMsg;
The command messages (from the base station) have the following structure:
typedef struct CSNCmdMsg { uint8_t type; uint16_t addr; uint32_t newvalue; } __attribute__ ((packed)) CSNCmdMsg;
The alarm message (to the base station) has the following stgructure:
typedef struct CSNAlarmMsg { uint16_t type; uint16_t addr; uint32_t value; } __attribute__ ((packed)) CSNAlarmMsg;
Finally, we define a health-status message used to update the server on the motes condition:
typedef struct CSNHealthStatusMsg { uint16_t type; uint16_t addr; uint16_t parentAddr; uint32_t voltage; uint32_t parentRSSI; } __attribute__ ((packed)) CSNHealthStatusMsg;
4.3.1 IO Subsystem
This subsystem is connected to the Serial Forwarder via a MoteIF. ICMonNetwork handles the reception of the messages from the motes and the emission of the commands from the NMS. Uses query results to dispatch the results to the DBLogger, and to send to the CommandConnection objects the results of commands that need to be displayed on the corresponding terminal. The time stamping of the incoming message is done at this point. CommandConnection: handles the commands sent by a client to the sensor network. Each CommandConnection is associated with a different communication socket. Ref.: CS-HLD-042907 17-11
CommandServer: spawn a new CommandConnection process for each new command to be sent to the motes. The CommandConnection waits until the expected response is received from the sensor network. The Commandserver is typically involved by the web interface (createSocket command in the php code) and returns results to the results where it got them from.
4.3.1.1 ICMonNetwork
Listens to the serial forwarder and dispatches packets. MessageReceived(int addr, Message m): called when a message is received from the Serial Forwarder. Typically formats a query result and sends it to DBLogger in order to be introduced in the database. It may also send the query back to the active CommandConnections for display. SendQuery(ICMonQuery q): Used to send a query out over the radio.
4.3.1.2 CommandConnection (Thread)
Is created with an ICMonNetwork as parameter on a particular socket. run() Opens a BufferedReader to process an input streams of commands (StringTokenizer). Connects to ICMonNetwork in oder to send the commands (ICMonNetwork.sendQuery()). messageReceived(int addr, Message m) : relays back to the web interface the responses of the commands received from the sensor network.
4.3.1.3 CommandServer (Thread)
Listens on a server socket for client connections and opens a new socket for every client connection.
4.3.3 NMS
ICMonQuery formats the queries to the motes and waits for the query results to send them to the DBLogger.
Ref.: CS-HLD-042907
17-12
addr INT, value INT ); -- table to store information about motes create table icmon_mote_info ( nodeid INT PRIMARY KEY, location_x INT, location_y INT, type varchar(30), location VARCHAR(255), comment VARCHAR(1000), lastbatchange TIMESTAMP ); -- table to store parent statistics CREATE TABLE icmon_routing_parent ( id SERIAL PRIMARY KEY, time TIMESTAMP NOT NULL, nodeid INT REFERENCES icmon_mote_info ON DELETE CASCADE ON UPDATE CASCADE, parent INT NOT NULL, quality INT DEFAULT -1, depth INT DEFAULT -1, occupancy INT DEFAULT -1, );
4.3.7 Tools
ICMonQuery: to format command messages before sending them through the Serial Forwarder. Its methods are of the form getXXXMsg() and setXXXMsg() to format the right type of message. The output is always a message structure of the type CSNCmdMsg with the right parameters filled in (be it rate, transmission power etc.).
It is important not to use the leds for any other prupose than testing and debugging, since they are using a significant amount of energy when being powered on and off.
The getSensorFlags() and setSensorFlags() methods are used to enable/disable the relevant sensor probes (see paragraph 4.2 for more details) The main elements of CSNSense are: SensingTimer: The timer that triggers a new set of readings from the probes attached to the node. This timer is configurable. processData(): called by SensingTimer.fired(). Operates the different probes. xxxSensor.dataReady() : called when the data for the sensor xxx is ready. The data is assigned to a local variable (array of data), and when all new data are available, they are sent back to the base station. dataSendTask() : the task called to effectively send the data back to the base station. dataAverage() : compute the average of the last samples before discarding them. This is the only data processing done at the motes level at the moment. In a further release, more sophisticated processing may be included, such as differential coding when only the difference between successive samples is sent, aggregation or more complex averaging methods to be defined. checkRate(): called in xxxSensor.dataReady() to check the rate of changes of the data readings. In order to do that, it calls the SensorManager, whose interface it also uses. Any deviation of more than 10% in the data readings will be reported to the base station. Whenever possible, a SensorControl interface will be attached to each probe in order to optimize its power usage.
Ref.: CS-HLD-042907
17-14
4.4.2 SensorManager
SensorManagerM.nc: This component is used to detect what probes are active at power-up, and then to inspect periodically the sensors (typically at every sampling, or before sending a packet) in order to determine when to raise an alarm. It provides the following interface:
interface CSNManager { command result_t start(); // Idempotent command result_t stop(); // Idempotent command uint16_t getSensorActivity(); command void setSensorActivity(uint16_t sensorBA); command Result_t checkVariationRate(uint8_t sensor); asyncronous event setAlarm(uint8_t type); asynchronous event clearAlarm(uint8_t type) ; }
getSensorActivity(): verifies what sensors are active. Returns a bit array with the active sensors. setSensorActivity(): set the sensor activity based on a bit array. checkVariationRate() : is used to check if the last samples varied significantly. Return the standard deviation. If the deviation is above a threshold of 10%, it signals an event back to the module using the interface in order to trigger the emission of an alarm message. The Sensor manager also maintains an array of active and inactive alarms. setAlarm() : Signals an alarm. clearAlarm(): signals an alarm clearance.
Collection of alarms from the data processing module: handles the alarm and calls the SendAlarmTask() to report back to the server.
We do not used any synchronization between the different nodes of the network. The handling of the duty cycles is done with the preamble sampling done in B-MAC protocol (see CEDT2004 for more details)
6 Predeployment Tests
Graceful degradation Temperature Life-time 17-16
Ref.: CS-HLD-042907
7 Bibliography
Rao 2004 PR Seshagiri Rao, Madhav Gadgil, Ramakrishnappa, M Gangadhar, Report of user requirement survey, CES, CAOS, IISc. BANGALORE, 2004
Schmid 2004 Thomas Schmid, Sensorscope, MICS Summer Internship, EPFL, 2004, http://sensorscope.epfl.ch Panchard 2004 Jacques Panchard, COMMON-Sense Net System Requirements and High-Level Design, EPFL, 2004 CEDT2004 CEDT, COMMON-Sense Net, Working draft for MICA2 motes (Phase 1), Technical Report, November 17, 2004
Ref.: CS-HLD-042907
17-17