GSN:XMLconfigexamplesFrom SwissExperimentXMLconfigexamples
GSN XML Sensor Description File examplesGet data from a CSV file
<virtual-sensor name="WAN1" >
<processing-class>
<class-name>gsn.vsensor.BridgeVirtualSensor</class-name>
<unique-timestamps>true</unique-timestamps>
<init-params/>
<output-structure>
<field name='record' type='double'/>
<field name='RELATIVE_HUMIDITY' type='double'/>
<field name='AIR_TEMPERATURE' type='double'/>
<field name='WIND_SPEED_SCALAR_AV' type='double'/>
<field name='WIND_SPEED_VECTOR_AV' type='double'/>
<field name='WIND_DIRECTION' type='double'/>
<field name='WIND_DIRECTION_STDEV' type='double'/>
<field name='WIND_SPEED_MAX' type='double'/>
<field name='WIND_SPEED_NORTHERLY_COMPONENT' type='double'/>
<field name='WIND_SPEED_WESTERLY_COMPONENT' type='double'/>
<field name='WIND_SPEED_VERTICAL_COMPONENT' type='double'/>
<field name='INCOMING_SHORTWAVE_RADIATION' type='double'/>
<field name='OUTGOING_SHORTWAVE_RADIATION' type='double'/>
<field name='INCOMING_LONGWAVE_RADIATION' type='double'/>
<field name='OUTGOING_LONGWAVE_RADIATION' type='double'/>
</output-structure>
</processing-class>
<description>Wannengrat weather station 1 in Davos, Switzerland. Copyright owner of the data is SLF.</description>
<life-cycle pool-size="10" />
<addressing>
<predicate key='geographical'>Davos, Switzerland.</predicate>
<predicate key='LATITUDE'>46.7952138889</predicate>
<predicate key='LONGITUDE'>9.77391388889</predicate>
<predicate key='ALTITUDE'>2455</predicate>
<predicate key='NAME'>WAN1</predicate>
<predicate key='GPS_Precision'>10</predicate>
<predicate key='SLOPE'>0</predicate>
<predicate key='exposition'>NULL</predicate>
<predicate key='metadata'>http://www.swiss-experiment.ch/index.php/Wannengrat:Wan1</predicate>
</addressing>
<storage />
<streams>
<stream name="data" >
<source alias="source" storage-size="1" sampling-rate="1">
<address wrapper="csv">
<predicate key="file">/usr/local/pub/SLdata/Ede/Wan_1.met</predicate>
<predicate key="fields">timed,record,rh,ta,vw_wvc_1,vw_wvc_2,vw_wvc_3,vw_wvc_4,vw_max,vw_u,vw_v,vw_w,sw_in,sw_out,lw_in,lw_out</predicate>
<predicate key="formats">timestamp(y-M-d H:m:s),numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,nume
<predicate key="bad-values">NaN,6999,-6999, 7999,-7999, NULL</predicate>
<predicate key="timezone">Etc/GMT-1</predicate>
<predicate key="sampling">60000</predicate>
<predicate key="skip-first-lines">4</predicate>
<predicate key="check-point-directory">csv-check-points</predicate>
</address>
<query>select TIMED, record, RH AS RELATIVE_HUMIDITY, TA AS AIR_TEMPERATURE, VW_WVc_1 AS WIND_SPEED_SCALAR_AV, VW_WVc_2 AS WIND_SPEED_VECTOR_AV, VW_WVc_3 AS WIND_DIRECTION, VW_WVc_4 AS WIND_DIRECTION_STDEV, VW_Max AS WIND_SPEED_MAX, SW_in AS INCOMING_SHORTWAVE_RADIATION, SW_out AS OUTGOING_SHORTWAVE_RADIATION, LW_in AS INCOMING_LONGWAVE_RADIATION, LW_out AS OUTGOING_LONGWAVE_RADIATION from wrapper</query>
</source>
<query>select * from source</query>
</stream>
</streams>
</virtual-sensor>
Convert/calibrate the dataSimple example - data read direct from csv file and offset addedThis is a simple case where the data is read straight from the csv file and just corrected by its offset.
<virtual-sensor name="STILLBERG_DENDROMETERS_CORRECTED" >
<processing-class>
<class-name>gsn.vsensor.BridgeVirtualSensor</class-name>
<unique-timestamps>true</unique-timestamps>
<init-params/>
<output-structure>
<field name='RECORD' type='DOUBLE'/>
<field name='BATTERY_VOLTAGE' type='DOUBLE'/>
<field name='LOGGER_TEMPERATURE' type='DOUBLE'/>
<field name='DENDROMETER_01_E2L1' type='DOUBLE'/>
<field name='DENDROMETER_02_E1L1' type='DOUBLE'/>
<field name='DENDROMETER_03_A1L1' type='DOUBLE'/>
<field name='DENDROMETER_04_E1L2' type='DOUBLE'/>
<field name='DENDROMETER_05_E2L2' type='DOUBLE'/>
<field name='DENDROMETER_06_A2L2' type='DOUBLE'/>
<field name='DENDROMETER_07_A1L2' type='DOUBLE'/>
<field name='DENDROMETER_08_A2L1' type='DOUBLE'/>
<field name='DENDROMETER_09_A3L1' type='DOUBLE'/>
<field name='DENDROMETER_10_E3L2' type='DOUBLE'/>
<field name='DENDROMETER_11_A3L2' type='DOUBLE'/>
<field name='DENDROMETER_12_E3L1' type='DOUBLE'/>
<field name='DENDROMETER_13_A4L2' type='DOUBLE'/>
<field name='DENDROMETER_14_A4L1' type='DOUBLE'/>
<field name='DENDROMETER_15_E4L2' type='DOUBLE'/>
<field name='DENDROMETER_16_E4L1' type='DOUBLE'/>
<field name='DENDROMETER_17_A5L2' type='DOUBLE'/>
<field name='DENDROMETER_18_E5L1' type='DOUBLE'/>
<field name='DENDROMETER_19_E5L2' type='DOUBLE'/>
<field name='DENDROMETER_20_A5L1' type='DOUBLE'/>
</output-structure>
</processing-class>
<description>Data from dendrometers in the CO2 plots on Stillberg,
Davos. This data is manually retrieved, so may not always be current.
Bad data has been corrected where possible and corrected to equivalent
amplitudes. Data Copyright SLF</description>
<life-cycle pool-size="10" />
<addressing>
<predicate key='geographical'>Davos, Switzerland.</predicate>
<predicate key='LATITUDE'>46.771789</predicate>
<predicate key='LONGITUDE'>9.868281</predicate>
<predicate key='ALTITUDE'>2145</predicate>
<predicate key='NAME'>STILLBERG_DENDROMETERS_CORRECTED</predicate>
<predicate key='GPS_Precision'>10</predicate>
<predicate key='SLOPE'>0</predicate>
<predicate key='exposition'>NULL</predicate>
</addressing>
<storage />
<streams>
<stream name="data" >
<source alias="source" storage-size="1" sampling-rate="1">
<address wrapper="csv">
<predicate key="file">/usr/local/pub/OEKOGR/ALP/Projects_running/Stillberg/FACE_Experiment/2009_data/dendrometers_2009/stillberg_dendrometers_09_edited_v2.csv</predicate>
<predicate key="fields">timed,record,battery_voltage,logger_temperature,dendro_01,dendro_02,dendro_03,dendro_04,dendro_05,dendro_06,dendro_07,dendro_08,dendro_09,dendro_10,dendro_11,dendro_12,dendro_13,dendro_14,dendro_15,dendro_16,dendro_17,dendro_18,dendro_19,dendro_20</predicate> <predicate key="formats">timestamp(d/M/y H:m),numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric</predicate>
<predicate key="bad-values">NaN,6999,-6999,null</predicate>
<predicate key="timezone">Etc/GMT-1</predicate>
<predicate key="sampling">60000</predicate> <!-- every 1 minutes -->
<predicate key="skip-first-lines">4</predicate>
<predicate key="check-point-directory">csv-check-points</predicate>
</address>
<query>select TIMED,
RECORD,
BATTERY_VOLTAGE,
LOGGER_TEMPERATURE,
DENDRO_01-3966.596 as DENDROMETER_01_E2L1,
DENDRO_02-3453.833 as DENDROMETER_02_E1L1,
DENDRO_03-7801.985 as DENDROMETER_03_A1L1,
DENDRO_04-7882.180 as DENDROMETER_04_E1L2,
DENDRO_05-4906.517 as DENDROMETER_05_E2L2,
DENDRO_06-3220.112 as DENDROMETER_06_A2L2,
DENDRO_07-2894.618 as DENDROMETER_07_A1L2,
DENDRO_08-8754.918 as DENDROMETER_08_A2L1,
DENDRO_09-6990.018 as DENDROMETER_09_A3L1,
DENDRO_10-8773.319 as DENDROMETER_10_E3L2,
DENDRO_11-4929.745 as DENDROMETER_11_A3L2,
DENDRO_12-4884.581 as DENDROMETER_12_E3L1,
DENDRO_13-6745.599 as DENDROMETER_13_A4L2,
DENDRO_14-4102.134 as DENDROMETER_14_A4L1,
DENDRO_15-2221.883 as DENDROMETER_15_E4L2,
DENDRO_16-5385.416 as DENDROMETER_16_E4L1,
DENDRO_17-1643.639 as DENDROMETER_17_A5L2,
DENDRO_18-5971.411 as DENDROMETER_18_E5L1,
DENDRO_19-4231.752 as DENDROMETER_19_E5L2,
DENDRO_20-1342.224 as DENDROMETER_20_A5L1 from wrapper</query>
</source>
<query>select * from source</query>
</stream>
</streams>
</virtual-sensor>
Complex example - data read from another virtual sensor on the same gsn instance and cases used for different circumstancesThis is a complex case where we must prevent the power calculation from returning an error, hence have multiple cases. This sensor reads data from another virtual sensor on the same instance
<virtual-sensor name="biglink_damma_runoff_calibrated" priority="15" >
<processing-class>
<class-name>gsn.vsensor.BridgeVirtualSensor</class-name>
<unique-timestamps>true</unique-timestamps>
<output-structure>
<field name="CONDUCTIVITY" type="DOUBLE" />
<field name="WATERTEMP" type="DOUBLE" />
<field name="NO_OF_SAMPLES" type="DOUBLE" />
<field name="FLOWRATE_P_AVG" type="DOUBLE" />
<field name="FLOWRATE_P_MAX" type="DOUBLE" />
<field name="FLOWRATE_P_MIN" type="DOUBLE" />
<field name="FLOWRATE_R_AVG" type="DOUBLE" />
<field name="FLOWRATE_R_MAX" type="DOUBLE" />
<field name="FLOWRATE_R_MIN" type="DOUBLE" />
<field name="PHOTOSYNTH_RAD" type="DOUBLE" />
<field name="BATTMIN" type="DOUBLE" />
<field name="LOGTEMPAVG" type="DOUBLE" />
</output-structure>
</processing-class>
<description>This is the runoff data from the Damma Glacier with
calibrations applied.
battmin is the minimum battery voltage in the last 10 mins.
logtempavg is the average temperature (degrees C) of the logger during the last 10 mins.
Conductivity and watertemp are the instantaneous values of water conductivity and
temperature.
No of samples is the number of samples taken. Previous to 2009 this was
not reset at regular intervals, from 2009 this is reset at 00:00 every
day.
Flowrate_r/p_avg/max/min is the flow rate in litres/s, calculated as the
0.00028439 x (respective flow depth(cm) + 28.1647)^3.3476 . r is from the radar and p is
from the pressure sensor. The radar flow heights pre 1/1/09 are
corrected by 1702.562cm. Radar flow heights post 1/1/09 are corrected by 1694.334cm.
Photosynth_rad is the incident radiation in the photosynthetic spectrum
in umol/(s.m^2).
When sensors are not present in the data, values of -6999 have been
added to the data. nb. These values may be corrected by the calibration
values.
Data copyright CCES-BigLink project.
</description>
<life-cycle pool-size="10" />
<addressing>
<predicate key="geographical">Damma Glacier, Switzerland</predicate>
<predicate key="LATITUDE">46.64324</predicate>
<predicate key="LONGITUDE">8.4707778</predicate>
<predicate key="ALTITUDE">1844</predicate>
<predicate key="NAME">biglink_damma_runoff_calibrated</predicate>
</addressing>
<storage />
<streams>
<!-- case 1: all sensors working before height change -->
<stream name="source">
<source alias="data1" storage-size="1" sampling-rate="1">
<address wrapper="local">
<predicate key="NAME">biglink_damma_runoff_raw</predicate>
<predicate
key="start-time">2008-06-05T11:00:00.000-01:00</predicate>
</address>
<query> select * from wrapper where
timed < 1230768000100 and
RADAR_AVG > -4.996 and
PRESSURE_SENSOR_AVG IS NOT NULL and
PRESSURE_SENSOR_MAX IS NOT NULL and
PRESSURE_SENSOR_MIN IS NOT NULL</query>
</source>
<query>
select TIMED,
CONDUCTIVITY,
WATERTEMP,
NO_OF_SAMPLES,
(0.00028439*(POWER((PRESSURE_SENSOR_AVG+28.1647),3.3476))) as
FLOWRATE_P_AVG,
(0.00028439*(POWER((PRESSURE_SENSOR_MAX+28.1647),3.3476))) as
FLOWRATE_P_MAX,
(0.00028439*(POWER((PRESSURE_SENSOR_MIN+28.1647),3.3476))) as
FLOWRATE_P_MIN,
(0.00028439*(POWER(((RADAR_AVG*100)-1702.562 + 28.1647),3.3476))) as FLOWRATE_R_AVG,
(0.00028439*(POWER(((RADAR_MAX*100)-1702.562 + 28.1647),3.3476))) as FLOWRATE_R_MAX,
(0.00028439*(POWER(((RADAR_MIN*100)-1702.562 + 28.1647),3.3476))) as FLOWRATE_R_MIN,
PHOTOSYNTH_RAD,
BATTMIN,
LOGTEMPAVG from data1
</query>
</stream>
<!-- case 2: all sensors working after height change -->
<stream name="source2">
<source alias="data2" storage-size="1" sampling-rate="1">
<address wrapper="local">
<predicate key="NAME">biglink_damma_runoff_raw</predicate>
<predicate
key="start-time">2008-06-05T11:00:00.000-01:00</predicate>
</address>
<query>select * from wrapper where
timed > 1230768000100 and
RADAR_AVG > -4.996 and
PRESSURE_SENSOR_AVG IS NOT NULL and
PRESSURE_SENSOR_MIN IS NOT NULL and
PRESSURE_SENSOR_MAX IS NOT NULL</query>
</source>
<query>select TIMED,
CONDUCTIVITY,
WATERTEMP,
NO_OF_SAMPLES,
(0.00028439*(POWER((PRESSURE_SENSOR_AVG+28.1647),3.3476))) as
FLOWRATE_P_AVG,
(0.00028439*(POWER((PRESSURE_SENSOR_MAX+28.1647),3.3476))) as
FLOWRATE_P_MAX,
(0.00028439*(POWER((PRESSURE_SENSOR_MIN+28.1647),3.3476))) as
FLOWRATE_P_MIN,
(0.00028439*(POWER(((RADAR_AVG*100)-1694.334 + 28.1647),3.3476))) as FLOWRATE_R_AVG,
(0.00028439*(POWER(((RADAR_MAX*100)-1694.334 + 28.1647),3.3476))) as FLOWRATE_R_MAX,
(0.00028439*(POWER(((RADAR_MIN*100)-1694.334 + 28.1647),3.3476))) as FLOWRATE_R_MIN,
PHOTOSYNTH_RAD,
BATTMIN,
LOGTEMPAVG from data2 </query>
</stream>
<!-- case 3: radar not working -->
<stream name="source3">
<source alias="data3" storage-size="1" sampling-rate="1">
<address wrapper="local">
<predicate key="NAME">biglink_damma_runoff_raw</predicate>
<predicate
key="start-time">2008-06-05T11:00:00.000-01:00</predicate>
</address>
<query>select * from wrapper where
(RADAR_AVG < -4.99 or RADAR_AVG IS NULL)
and PRESSURE_SENSOR_AVG IS NOT NULL
and PRESSURE_SENSOR_MAX IS NOT NULL
and PRESSURE_SENSOR_MIN IS NOT NULL</query>
</source>
<query>select TIMED,
CONDUCTIVITY,
WATERTEMP,
NO_OF_SAMPLES,
(0.00028439*(POWER((PRESSURE_SENSOR_AVG+28.1647),3.3476))) as
FLOWRATE_P_AVG,
(0.00028439*(POWER((PRESSURE_SENSOR_MAX+28.1647),3.3476))) as
FLOWRATE_P_MAX,
(0.00028439*(POWER((PRESSURE_SENSOR_MIN+28.1647),3.3476))) as
FLOWRATE_P_MIN,
PHOTOSYNTH_RAD,
BATTMIN,
LOGTEMPAVG from data3</query>
</stream>
<!-- case 4: no pressure sensors working before height change -->
<stream name="source4">
<source alias="data4" storage-size="1" sampling-rate="1">
<address wrapper="local">
<predicate key="NAME">biglink_damma_runoff_raw</predicate>
<predicate
key="start-time">2008-06-05T11:00:00.000-01:00</predicate>
</address>
<query> select * from wrapper where
timed < 1230768000100 and
RADAR_AVG > -4.996 and
PRESSURE_SENSOR_AVG IS NULL and
PRESSURE_SENSOR_MAX IS NULL and
PRESSURE_SENSOR_MIN IS NULL</query>
</source>
<query>
select TIMED,
CONDUCTIVITY,
WATERTEMP,
NO_OF_SAMPLES,
(0.00028439*(POWER(((RADAR_AVG*100)-1702.562 + 28.1647),3.3476))) as FLOWRATE_R_AVG,
(0.00028439*(POWER(((RADAR_MAX*100)-1702.562 + 28.1647),3.3476))) as FLOWRATE_R_MAX,
(0.00028439*(POWER(((RADAR_MIN*100)-1702.562 + 28.1647),3.3476))) as FLOWRATE_R_MIN,
PHOTOSYNTH_RAD,
BATTMIN,
LOGTEMPAVG from data4
</query>
</stream>
<!-- case 5: no pressure sensors working after height change -->
<stream name="source5">
<source alias="data5" storage-size="1" sampling-rate="1">
<address wrapper="local">
<predicate key="NAME">biglink_damma_runoff_raw</predicate>
<predicate
key="start-time">2008-06-05T11:00:00.000-01:00</predicate>
</address>
<query>select * from wrapper where
timed > 1230768000100 and
RADAR_AVG > -4.996 and
PRESSURE_SENSOR_AVG IS NULL and
PRESSURE_SENSOR_MIN IS NULL and
PRESSURE_SENSOR_MAX IS NULL
</query>
</source>
<query>select TIMED,
CONDUCTIVITY,
WATERTEMP,
NO_OF_SAMPLES,
(0.00028439*(POWER(((RADAR_AVG*100)-1694.334 + 28.1647),3.3476))) as FLOWRATE_R_AVG,
(0.00028439*(POWER(((RADAR_MAX*100)-1694.334 + 28.1647),3.3476))) as FLOWRATE_R_MAX,
(0.00028439*(POWER(((RADAR_MIN*100)-1694.334 + 28.1647),3.3476))) as FLOWRATE_R_MIN,
PHOTOSYNTH_RAD,
BATTMIN,
LOGTEMPAVG from data5 </query>
</stream>
<!-- case 6: no sensors working -->
<stream name="source6">
<source alias="data6" storage-size="1" sampling-rate="1">
<address wrapper="local">
<predicate key="NAME">biglink_damma_runoff_raw</predicate>
<predicate
key="start-time">2007-09-22T05:40:00.000-0100</predicate>
</address>
<query>select * from wrapper where
PRESSURE_SENSOR_AVG IS NULL and
PRESSURE_SENSOR_MIN IS NULL and
PRESSURE_SENSOR_MAX IS NULL and
(RADAR_AVG < -4.99 OR RADAR_AVG IS NULL)</query>
</source>
<query>select TIMED,
CONDUCTIVITY,
WATERTEMP,
NO_OF_SAMPLES,
PHOTOSYNTH_RAD,
BATTMIN,
LOGTEMPAVG from data6 </query>
</stream>
<!-- case 7: no sensors apart from PRESSURE SENSOR MAX working -->
<stream name="source7">
<source alias="data7" storage-size="1" sampling-rate="1">
<address wrapper="local">
<predicate key="NAME">biglink_damma_runoff_raw</predicate>
<predicate
key="start-time">2007-09-22T05:40:00.000-0100</predicate>
</address>
<query>select * from wrapper where
PRESSURE_SENSOR_AVG IS NULL and
PRESSURE_SENSOR_MIN IS NULL and
PRESSURE_SENSOR_MAX IS NOT NULL and
(RADAR_AVG < -4.99 OR RADAR_AVG IS NULL)</query>
</source>
<query>select TIMED,
CONDUCTIVITY,
WATERTEMP,
NO_OF_SAMPLES,
(0.00028439*(POWER((PRESSURE_SENSOR_MAX+28.1647),3.3476))) as
FLOWRATE_P_MAX,
PHOTOSYNTH_RAD,
BATTMIN,
LOGTEMPAVG from data7 </query>
</stream>
<!-- case 8: no sensors apart from PRESSURE SENSOR MIN working -->
<stream name="source8">
<source alias="data8" storage-size="1" sampling-rate="1">
<address wrapper="local">
<predicate key="NAME">biglink_damma_runoff_raw</predicate>
<predicate
key="start-time">2007-09-22T05:40:00.000-0100</predicate>
</address>
<query>select * from wrapper where
PRESSURE_SENSOR_AVG IS NULL and
PRESSURE_SENSOR_MIN IS NOT NULL and
PRESSURE_SENSOR_MAX IS NULL and
(RADAR_AVG < -4.99 OR RADAR_AVG IS NULL)</query>
</source>
<query>select TIMED,
CONDUCTIVITY,
WATERTEMP,
NO_OF_SAMPLES,
(0.00028439*(POWER((PRESSURE_SENSOR_MIN+28.1647),3.3476))) as
FLOWRATE_P_MIN,
PHOTOSYNTH_RAD,
BATTMIN,
LOGTEMPAVG from data8 </query>
</stream>
<!-- case 9: no sensors apart from PRESSURE SENSOR AVG working -->
<stream name="source9">
<source alias="data9" storage-size="1" sampling-rate="1">
<address wrapper="local">
<predicate key="NAME">biglink_damma_runoff_raw</predicate>
<predicate
key="start-time">2007-09-22T05:40:00.000-0100</predicate>
</address>
<query>select * from wrapper where
PRESSURE_SENSOR_AVG IS NOT NULL and
PRESSURE_SENSOR_MIN IS NULL and
PRESSURE_SENSOR_MAX IS NULL and
(RADAR_AVG < -4.99 OR RADAR_AVG IS NULL)</query>
</source>
<query>select TIMED,
CONDUCTIVITY,
WATERTEMP,
NO_OF_SAMPLES,
(0.00028439*(POWER((PRESSURE_SENSOR_AVG+28.1647),3.3476))) as
FLOWRATE_P_AVG,
PHOTOSYNTH_RAD,
BATTMIN,
LOGTEMPAVG from data9 </query>
</stream>
<!-- case 10: no sensors apart from PRESSURE SENSOR AVG and MAX working -->
<stream name="source10">
<source alias="data10" storage-size="1" sampling-rate="1">
<address wrapper="local">
<predicate key="NAME">biglink_damma_runoff_raw</predicate>
<predicate
key="start-time">2007-09-22T05:40:00.000-0100</predicate>
</address>
<query>select * from wrapper where
PRESSURE_SENSOR_AVG IS NOT NULL and
PRESSURE_SENSOR_MIN IS NULL and
PRESSURE_SENSOR_MAX IS NOT NULL and
(RADAR_AVG < -4.99 OR RADAR_AVG IS NULL)</query>
</source>
<query>select TIMED,
CONDUCTIVITY,
WATERTEMP,
NO_OF_SAMPLES,
(0.00028439*(POWER((PRESSURE_SENSOR_AVG+28.1647),3.3476))) as FLOWRATE_P_AVG,
(0.00028439*(POWER((PRESSURE_SENSOR_MAX+28.1647),3.3476))) as FLOWRATE_P_MAX,
PHOTOSYNTH_RAD,
BATTMIN,
LOGTEMPAVG from data10 </query>
</stream>
<!-- case 11: no sensors apart from PRESSURE SENSOR AVG and MIN working -->
<stream name="source11">
<source alias="data11" storage-size="1" sampling-rate="1">
<address wrapper="local">
<predicate key="NAME">biglink_damma_runoff_raw</predicate>
<predicate
key="start-time">2007-09-22T05:40:00.000-0100</predicate>
</address>
<query>select * from wrapper where
PRESSURE_SENSOR_AVG IS NOT NULL and
PRESSURE_SENSOR_MIN IS NOT NULL and
PRESSURE_SENSOR_MAX IS NULL and
(RADAR_AVG < -4.99 OR RADAR_AVG IS NULL)</query>
</source>
<query>select TIMED,
CONDUCTIVITY,
WATERTEMP,
NO_OF_SAMPLES,
(0.00028439*(POWER((PRESSURE_SENSOR_AVG+28.1647),3.3476))) as FLOWRATE_P_AVG,
(0.00028439*(POWER((PRESSURE_SENSOR_MIN+28.1647),3.3476))) as FLOWRATE_P_MIN,
PHOTOSYNTH_RAD,
BATTMIN,
LOGTEMPAVG from data11 </query>
</stream>
<!-- case 12: no sensors apart from PRESSURE SENSOR MAX and MIN working -->
<stream name="source12">
<source alias="data12" storage-size="1" sampling-rate="1">
<address wrapper="local">
<predicate key="NAME">biglink_damma_runoff_raw</predicate>
<predicate
key="start-time">2007-09-22T05:40:00.000-0100</predicate>
</address>
<query>select * from wrapper where
PRESSURE_SENSOR_AVG IS NULL and
PRESSURE_SENSOR_MIN IS NOT NULL and
PRESSURE_SENSOR_MAX IS NOT NULL and
(RADAR_AVG < -4.99 OR RADAR_AVG IS NULL)</query>
</source>
<query>select TIMED,
CONDUCTIVITY,
WATERTEMP,
NO_OF_SAMPLES,
(0.00028439*(POWER((PRESSURE_SENSOR_MAX+28.1647),3.3476))) as FLOWRATE_P_MAX,
(0.00028439*(POWER((PRESSURE_SENSOR_MIN+28.1647),3.3476))) as FLOWRATE_P_MIN,
PHOTOSYNTH_RAD,
BATTMIN,
LOGTEMPAVG from data12 </query>
</stream>
</streams>
</virtual-sensor>
Get data from a virtual sensor on another server
<virtual-sensor name="WAN2" >
<processing-class>
<class-name>gsn.vsensor.BridgeVirtualSensor</class-name>
<unique-timestamps>true</unique-timestamps>
<init-params/>
<output-structure>
<field name='RECORD' type='double'/>
<field name='RELATIVE_HUMIDITY' type='double'/>
<field name='AIR_TEMPERATURE' type='double'/>
<field name='WIND_SPEED_NORTHERLY_COMPONENT' type='double'/>
<field name='WIND_SPEED_WESTERLY_COMPONENT' type='double'/>
<field name='WIND_SPEED_VERTICAL_COMPONENT' type='double'/>
<field name='SNOW_HEIGHT' type='double'/>
<field name='WIND_SPEED_SCALAR_AV' type='double'/>
<field name='WIND_SPEED_VECTOR_AV' type='double'/>
<field name='WIND_DIRECTION' type='double'/>
<field name='WIND_DIRECTION_STDEV' type='double'/>
<field name='WIND_SPEED_MAX' type='double'/>
</output-structure>
</processing-class>
<description>Wannengrat weather station 2 in Davos, Switzerland.
Copyright owner of the data is SLF.</description>
<life-cycle pool-size="10" />
<addressing>
<predicate key='geographical'>Davos, Switzerland.</predicate>
<predicate key='LATITUDE'>46.8007638888</predicate>
<predicate key='LONGITUDE'>9.775938888</predicate>
<predicate key='ALTITUDE'>2400</predicate>
<predicate key='NAME'>WAN2</predicate>
<predicate key='GPS_Precision'>10</predicate>
<predicate key='SLOPE'>0</predicate>
<predicate key='exposition'>NULL</predicate>
<predicate key='metadata'>http://www.swiss-experiment.ch/index.php/Wannengrat:Wan2</predicate>
</addressing>
<storage />
<streams>
<stream name="data" >
<source alias="source" storage-size="1" sampling-rate="1">
<address wrapper="remote">
<predicate key="host">montblanc.slf.ch</predicate>
<predicate key="port">22001</predicate>
<predicate key="query">select * from WAN2</predicate>
<predicate key="local-contact-point">http://localhost:3000/streaming/</predicate>
<predicate key="start-time">2006-11-01T00:00:01.000+01:00</predicate>
</address>
<query>select TIMED, RECORD, RELATIVE_HUMIDITY, AIR_TEMPERATURE, WIND_SPEED_SCALAR_AV, WIND_SPEED_VECTOR_AV, WIND_DIRECTION, WIND_DIRECTION_STDEV, WIND_SPEED_MAX, SNOW_HEIGHT from wrapper</query>
</source>
<query>select * from source</query>
</stream>
</streams>
</virtual-sensor>
Get data from a SensorScope station
<virtual-sensor name="sensorscope_1053" priority="10">
<processing-class>
<class-name>gsn.vsensor.SensorScope2VS</class-name>
<unique-timestamps>true</unique-timestamps>
<init-params>
<param name="allow-nulls">true</param>
</init-params>
<output-structure>
<field name="wind_direction" type="double"/>
<field name="wind_speed" type="double"/>
<field name="soil_water_potential" type="double"/>
<field name="soil_water_potential_2" type="double"/>
<field name="soil_moisture_ectm" type="double"/>
<field name="soil_temp_ectm" type="double"/>
<field name="air_humid" type="double"/>
<field name="air_temp" type="double"/>
<field name="cpu_temp" type="double"/>
<field name="cpu_volt" type="double"/>
<field name="ext_batt_volt" type="double"/>
<field name="int_batt_volt" type="double"/>
</output-structure>
</processing-class>
<description>SwissEx SensorScope 1054 (slave)</description>
<life-cycle pool-size="10"/>
<addressing>
</addressing>
<streams>
<stream name="input1">
<source alias="source1" sampling-rate="1" storage-size="1">
<address wrapper="sensorscope2">
<predicate key="source">sf@sensorscop1.epfl.ch:5010</predicate>
<predicate key="station_id">1053</predicate>
<predicate key="rate">180000</predicate>
</address>
<query>select timed,
wind_direction,
wind_speed,
soil_water_potential,
soil_water_potential_2,
soil_moisture_ectm,
soil_temp_ectm,
air_humid,
air_temp,
cpu_temp,
cpu_volt,
ext_batt_volt,
int_batt_volt from wrapper
</query>
</source>
<query>select * from source1</query>
</stream>
</streams>
</virtual-sensor>
VS to email on crossing a thresholdThis is a virtual sensor to email you when you cross a specified threshold. It can also be used with many other processing requirements. (Documentation)
<virtual-sensor name="emailtest" priority="10">
<processing-class>
<class-name>gsn.processor.ScriptletProcessor</class-name>
<init-params>
<param name="persistant">false</param>
<param name="scriptlet">
<![CDATA[
// This script sends an email to alert that the heap value (from the local wrapper)
// has reached a new maxima.
// Please set your SMTP configuration (in the conf/emails.properties) prior to use this script.
// Initialize the stateful variable maxima
if ( ! isdef('flag'))
flag = 0;
// Check if air_temperature <= 0
if (AIR_TEMPERATURE <= 0) {
if (flag == 0) {
flag = 1;
// Notify by email
def emailTitle = "GSN Notification - Temperature is below freezing: " + AIR_TEMPERATURE;
def emailContent = "Warning, it's cold outside!: " + AIR_TEMPERATURE;
def recipients = ["dawes@slf.ch"];
sendEmail(recipients, emailTitle, emailContent);
}
}
// Check if air_temperature > 5
if (AIR_TEMPERATURE > 5) {
flag = 0;
}
]]>
</param>
</init-params>
<output-structure/>
</processing-class>
<description>
This is a test vs to email you when it's cold outside
</description>
<addressing/>
<streams>
<stream name="stream1">
<source alias="source1" storage-size="1" sampling-rate="1">
<address wrapper="remote">
<predicate key="host">localhost</predicate>
<predicate key="port">22001</predicate>
<predicate key="query">select * from WAN1</predicate>
<predicate key="local-contact-point">http://localhost:22004/streaming/</predicate>
<predicate key="start-time">2010-05-14T00:00:01.000+01:00</predicate>
</address>
<query>select AIR_TEMPERATURE from wrapper</query>
</source>
<query>select * from source1</query>
</stream>
</streams>
</virtual-sensor>
|
