Professional Documents
Culture Documents
NewXXX
Fig. 2: High-Level Block diagramof the Device Gateway Functionality
In the next sections the specific and novel features of the
design are being discussed in more detail.
IV. VIRTUAL SENSOR VALUES
One of the most unique and value added features of our
gateway architecture is the ability to generate virtual sensor
data (computed data) based on other (virtual) sensor data in a
dependency checked way. Thus a value, which exists only
virtually, is based on other values (dependent upon them).
When a virtual value is evaluated these dependencies (which
could be virtual values as well) are evaluated at that moment
(when accessed) as well, resulting in an always correct and
accurate delivered value.
These virtual sensors, whose value calculation would have
to be done outside of a device gateway by most other gateway
implementations (and then not be accessible as sensor values
at all, but as alternative associated data), are very important.
This is important as very often dynamic values, based on
existing ones, are needed and not all data, which is required to
calculate the value, can or should be transported over the
network. So as an example - it does not make sense to
retrieve once every minute the last 10 samples for a sensor
from a database (as most systems only provide the actual last
value in memory) to dynamically determine the running mean
or the difference to a standard value in an external system.
The calculation can and should be done on the gateway as all
data is present there (so no data movement and additional
external logic is needed). In addition some values might only
arise (or make sense) as a reaction (trigger) to a change of
another value.
As an example the following scenario could be imagined:
A temperature sensor generates data every second
Average, min and max temperature values could be
defined as virtual sensor values, based on the last 10
physical values of the sensor (which are kept in
memory on the gateway). So whenever the temperature
sensor delivers a new value the virtual sensor values
would also calculate new values.
sd System Ov erv i ew
Presentation Control Data Storage Device Abstraction
DeviceGateway Core
Data Storage
+MySQL
+SQL Server
+XML file
+ DataStorage
Device Scanner Tasks
(PULL)
Dev i ceProtocol Handl er
+CNDEPDevice
+RESTDevice
+RS485Device
+SPIDevice
+ Devi ceCommuni cati on
Application Interface
Virtual Value
Computation
Trigger / Filter
Evaluation
Appl i cati onCommuni cati onHandl er
+RESTHandler
+SOAPHandler
+ Communi cati onHandl er
Runti meEv al uati on
+DllCode
+DotNetAssemblyCode
+PythonCode
+RubyCode
+ Executabl eBl ock
SensorValueManagement
DataCleansingTasks
Sensor
Actuator
WorkflowExecution
Workfl owExecuti on
+WindowsWorkflowFoundation
+ Workfl ow
handle requests
PUSH data
PUSH
data
PUSH data
store / retrieve
trace
trace
Scan &Retrieve
International Journal of Sensor and Related Networks (IJSRN)
Volume 1,Issue1 , February 2013
http://ijsrn.info/article/IJSRNV1I104.pdf
34
A virtual sensor value with 0 or 1 could be defined,
which delivers 1 (true) if the value exceeds 300 Kelvin.
So the virtual value would be recalculated every time
new data from the physical sensor arrives
Internally the virtual sensor values would be defined as
triggered by a change in the temperature sensor value.
Whenever the sensor values change, the triggers fire and the
corresponding values are automatically updated as well. This
could as a way of automated control trigger a workflow as
well, which sends a signal to an actuator to close (for example)
a valve.
Optionally a virtual value can be declared as evaluate on
query which means that for each request the value is
computed anew to yield the actual data value.
To be independent of a data change (which might never
happen) cyclic tasks, which just re-evaluate the virtual values,
are provided as well.
Whenever new physical data arrives, the sensor definition
(the current value part) is updated, which causes a triggering
of the trigger evaluation and value calculation process. This
process, by means of the virtual sensor value evaluation
engine, then calculates a value and delivers it to the process
that uses it as input value for the virtual sensor.
In addition the virtual sensor update task performs updates
for those sensors which have a timer based auto-update
specified as well.
In order to use an as flexible as possible approach, the
definition for the virtual sensor value evaluation must be
enabled to use:
Evaluations in a dynamic loadable external
executable (like a .NET assembly) which would be
the fastest execution method
Evaluations of an internal script in a dynamic
language like Ruby or Python
Evaluations based on SQL (so as to easily use
existing data from the database)
V. FILTERS
With filtering it is possible to inspect, alter and possibly
reject values that do not conform to the specification of the
particular device or application environment. Each value from
a sensor is passed through several sets of filter chains (which
can be different for each sensor) and each filter can fully
modify the value or reject it.
These sets of filter chains are for the various stages a value
can be in: newly arrived, ready to be used for computation for
dependent values or ready to be stored. This is necessary as
e.g. a value might need filtering in terms of min / max checks
after arrival, whereas before being used for computation some
adjustments (e.g. rounding) should be implemented.
The filters themselves can be, like the virtual sensor
evaluation, in any of the provided environments (compiled
assembly, script or SQL), Python as a scripting language
perhaps being the predominant candidate.
VI. PUSH / PULL-MODEL FOR SENSOR READING
As sensors can have different characteristics (latency, time
it takes for a value to change, importance of the value for the
application) as well as intelligence (in terms of ability to
store data locally and / or to transmit on its own behalf),
different models to connect them to the gateway must be
present. While a temperature sensor for the outside
temperature barely needs reading more than once a minute
and thus can be comfortably pulled (or even store the values
locally and thus be queried just once a day), a temperature
sensor controlling an acids temperature in a chemical process
might need a reaction time within several hundred
milliseconds and could even be in an alarm state which needs
immediate propagation.
The device gateway therefore supports PULL-mode with
different pulling frequencies for sensors (configured when the
sensor is registered) and PUSH-mode where the gateway
reacts to data from the sensor. In addition a bi-directional
mode is present which allows for PULL, but a PUSH (in case
of e.g. an emergency) as well.
To provide mass transport of data (when a sensor has e.g.
collected hundreds or thousands of samples) a burst mode in
PULL is present as well which is just a bulk import.
VII. REFERENCE IMPLEMENTATION
The reference implementation, which is available as open
source, was implemented using C# in the .NET 4.0
environment using available free of charge products (like SQL
Server Express as a database), and so all parts of the solution
can be run without using royalty based software (except
Windows as such here Mono might be an alternative). For
Python and Ruby the corresponding packages IronPython and
IronRuby were used.
As a handler for the WS* and REST-requests the WCF
(Windows Communication Foundation) infrastructure in IIS
was utilized to have an easy, declaration based (contract first)
development environment, which is much easier to maintain
and extend. Should the need arise this can be changed easily
to a more classical request-handler-loop approach.
All implementation specific parts can be exchanged as
dynamic handlers are used which would e.g. allow to
exchange SQL Server to mySQL, and so on.
Initial tests, were done in several areas with the following
preliminary results:
4 different .NET Micro Framework boards were used
successfully for REST-based communication to the
gateway (CNDEP is currently in testing) with data
being PULLed, PUSHed and bulk loaded; so device
communication and server-side scanner tasks work
fine
A simulator for setting and getting values shows that
the gateway (running on modern year 2011 server
hardware) is capable of handling more than 100,000
sensors with 100 data items in memory for each with
more than 10 billion sensor readings in the database
and still delivering values to 1000 clients in parallel in
2.6 msec as average to 16 msec as maximum / request
International Journal of Sensor and Related Networks (IJSRN)
Volume 1,Issue1 , February 2013
http://ijsrn.info/article/IJSRNV1I104.pdf
35
WS*, REST and OData as client protocols work
reasonable fast and stable
Triggering (using Python and .NET Assembly tests)
works in the range of 10 milliseconds even for
complex trigger chains and value evaluation on
request (using Python) shows a decrease in response
time (for simple to moderate scripts) of around 10%
allowing this to be used for many sensors as well
Running the server in an extended simulation over
several days with billions of set / get operations
(device and client) showed no memory leaks /
performance degradations
VIII. CONCLUSION AND FUTURE WORK
In this paper we have shown a working architecture for an
extendable device gateway, capable of being integrated into
applications environments by means of WS* (SOAP), REST,
OData and other (future) protocols, which provides additional
value by means of dynamically computed values, triggers,
filters and autonomous control using workflows.
Especially by using CNDEP and / or REST as a
communication protocol from the gateway to highly
intelligent devices with independent computational power
(e.g. .NET MicroFramework boards, SunSPOT, J ava-based
devices or Smart Devices in general), a powerful option for
the future is present.
After having the initial reference implementation ready, the
next steps involve several extensions, implementations in
reference environments to gain critical insight into perhaps
existent problems and needed enhancements
Various timing measures especially in the trigger / virtual
value evaluation and workflow execution have to be made to
make sure that a stable environment exists which executes in a
determinable way and gracefully handles errors and problems.
Another area of experiments will be the broader device
integration (scanner tasks / general device tasks) as well as
handling data internally to the server.
The option to load mass data from external sources, not
generated by sensors, but used for computations (e.g. cost of
energy per kWh as a basis to generate power cost as a virtual
value; a demand shown by [18] as well) has to be
implemented.
Another major task for a future improvement will be the
extension of the internal data types to cover more sensor types
(getting closer to SensorML or perhaps even adopting it) and
the provisioning of additional sensor protocols to make sensor
integration (especially industry sensors) much easier. This
includes pre-configured additional scanner tasks and enhanced
configuration in this area as well.
REFERENCES
[1] Aberer, K., Hauswirth, M. & Salehi, A., 2006. A Middleware for Fast
and Flexible Sensor Network Deployment. In VLDB 2006. VLDB
2006. Available at:
http://portal.acm.org/citation.cfm?id=1182635.1164243 [Accessed
October 14, 2010].
[2] Schramm, P. et al., 2004. A Service Gateway for networked sensor
systems. Pervasive Computing, 1(3), 66-74.
[3] Pautasso, C., Zimmermann, O. & Leymann, F., 2008. RESTful Web
Services vs Big Web Services. In Proceeding of the 17th international
conference on World Wide Web. International World Wide Web
Conference.
Available at: http://portal.acm.org/citation.cfm?id=1367606 [Accessed
September 29, 2010].
[4] Guinard, D. & Trifa, V., 2009. Towards the Web of Things Web
Mashups for Embedded Devices. In WWW 2009. Available at:
[Accessed August 19, 2010].
[5] Stirbu, V., 2007. Towards a RESTful Plug and Play Experience in the
Web of Things. In International Conference on Semantic Computing.
IEEE Dawson-Haggerty, S. et al., 2010. sMAP - a Simple
Measurement and Actuation Profile for Physical Information. In
SenSys 2010.
[6] Pachube - data infrastructure for the Internet of Things. Available at:
http://www.pachube.com/ [Accessed March 21, 2011].
[7] Kansal, A. et al., SenseWeb: An Infrastructure for Shared Sensing.
Available at:
http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=4354151
[Accessed November 9, 2010].
[8] Open Data Protocol (OData). Available at: http://www.odata.org/
[Accessed March 21, 2011].
[9] Vasters, C., 2012. Internet of Things - Using Windows Azure Service
Bus for ... Things! [WWW Document]. Using Windows Azure Service
Bus for ... Things! URL http://msdn.microsoft.com/en-
us/magazine/jj133819.aspx
[10] Internet of Things - A Smart Thermostat on the Service Bus [WWW
Document], 2012. . URL http://msdn.microsoft.com/en-
us/magazine/jj190807.aspx
[11] SENSEI - Home [WWW Document], 2012. . URL http://www.sensei-
project.eu/
[12] Internet of Things - Architecture IOT-A: Internet of Things
Architecture [WWW Document], 2012. . URL http://www.iot-
a.eu/public
[13] Trifa, V., Wieland, S., Guinard, D., Bohnert, T.M., 2009. Design and
implementation of a gateway for web-based interaction and
management of embedded devices. Submitted to DCOSS.
[14] Haller, S., Magerkurth, C., n.d. The Real-time Enterprise: IoT-enabled
Business Processes, in: IETF IAB Workshop on Interconnecting Smart
Objects with the Internet (March 2011).
[15] Prehofer, C., van Gurp, J ., di Flora, C., 2007. Towards the web as a
platform for ubiquitous applications in smart spaces, in: Second
Workshop on Requirements and Solutions for Pervasive Software
Infrastructures (RSPSI), at Ubicomp.
[16] Debaty, P., Caswell, D., 2001. Uniformweb presence architecture for
people, places, and things. Personal Communications, IEEE 8, 4651.
[17] Extended Environments Markup Language: EEML [WWW Document],
2010. . URL http://www.eeml.org/
[18] Dawson-Haggerty, S., Krioukov, A., Culler, D.E., 2012. Experiences
Integrating Building Data with sMAP ( No. Technical Report No.
UCB/EECS-2012-21). Electrical Engineering and Computer Sciences
University of California at Berkeley.
[19] Aslam, M.S., O Regan, E., Rea, S., Pesch, D., 2009. Open Framework
Middleware: An Experimental Middleware Design Concept for
Wireless Sensor Networks. Presented at the MUCS2009.
[20] Debaty, P., Caswell, D., 2001. Uniformweb presence architecture for
people, places, and things. Personal Communications, IEEE 8, 4651.
[21] Vazquez, J .I., De Ipina, D.L., Sedano, I., 2007. Soam: A web-powered
architecture for designing and deploying pervasive semantic devices.
International J ournal of Web Information Systems 2, 212224.
[22] Priyantha, N.B., Kansal, A., Goraczko, M., Zhao, F., 2008. Tiny web
services: design and implementation of interoperable and evolvable
sensor networks, in: Proceedings of the 6th ACM Conference on
Embedded Network Sensor Systems. pp. 253266.
[23] Kakanakov, N., Stankov, I., Shopov, M., Spasov, G., 2006. Controller
Network Data Extracting Protocoldesign and implementation, in: Proc.
CompSysTech.
[24] Spasov, G., Stankov, I., Petrova, G., n.d. WIRELESS REAL-TIME
GATEWAY (WRTG) FOR EMBEDDED DEVICES.
[25] Guinard, D., Trifa, V., Mattern, F., Wilde, E., 2011. Fromthe Internet
of Things to the Web of Things: Resource-oriented Architecture and
Best Practices. Architecting the Internet of Things 97129.
International Journal of Sensor and Related Networks (IJSRN)
Volume 1,Issue1 , February 2013
http://ijsrn.info/article/IJSRNV1I104.pdf
36