Вы находитесь на странице: 1из 9

IEEE INTERNET OF THINGS JOURNAL, VOL. 5, NO.

2, APRIL 2018 687

Context Design and Tracking for IoT-Based


Energy Management in Smart Cities
Carlos A. Kamienski, Member, IEEE, Fabrizio F. Borelli, Gabriela O. Biondi,
Isaac Pinheiro, Ivan D. Zyrianoff, and Marc Jentsch

Abstract—The advent of the Internet of Things (IoT) and its There is currently an unbridged gap related to the under-
innumerous applications for Smart Cities emphasizes the need standing of the relationship between context entities and of
for context-aware systems able to adapt behavior automatically to tracking the occurrence of events in IoT-based applications.
instant environment conditions. Currently, there is a gap in terms
of understanding how context information is interrelated, as well Context modeling remains a low level process that requires
as tracking which events occurred under which conditions within higher levels of human expertise. Visualizing, specifying,
certain context scopes. Visualizing, specifying, tracking and mon- tracking, and monitoring typical contexts involved in IoT-
itoring typical contexts involved in IoT-based applications are based applications are still challenging activities. Data man-
still challenging activities since context modeling remains a low agement strategies in IoT-generated big data scenarios require
level process that requires much human expertise. In this paper
we propose a new context life cycle that involves context design a deeper understanding of context information and there-
and context tracking. We developed a context-aware management fore we argue that context design and context tracking
framework, where contexts are modeled as graphs and can be are essential activities of a context life cycle for Smart
explicitly designed and their occurrences can be tracked down. Cities.
We believe that this feature of designing and tracking context In this paper, we advocate that not only low-level context
graphs may help developers, administrators, and end-users in
harnessing the wealth of information generated by highly scalable modeling for context reasoning purposes is needed, but also
IoT systems. higher-level context modeling can be easily expressed and
understood by humans. Context design is a high-level con-
Index Terms—Context-aware management, Internet of
Things (IoT), Smart Cities, smart energy management. text modeling approach, where entities and their relationship
are represented as a context graph. It provides three key fea-
tures for an IoT-based application for Smart Cities, such as
I. I NTRODUCTION smart energy management.
ONTEXT-AWARE systems first appeared in a pre- 1) Users can explicitly design contexts that were planned
C Internet era, where no one imagined that nowadays
they would have a perfect symbiotic relationship with the
to occur in a given setting.
2) Implicit nonplanned contexts, both wanted and unwanted
Internet of Things (IoT), helping us to make sense out of ones, can be tracked and expressed in the same model
the wealth of information generated by different types of sen- used on explicitly created contexts.
sors. By making systems able to adapt behavior automatically, 3) Both explicitly created and implicitly discovered con-
context-aware management for IoT has been increasingly used texts can be actively monitored for troubleshooting,
within the scope of big data analytics [12], [14]. Regardless of auditing and demonstration purposes.
how sensor data and other information are managed, context We developed and deployed a context-aware management
needs to be fully understood and carefully considered in IoT- system, where contexts are modeled as graphs, which can
based applications in order to guarantee an effective, efficient, be explicitly designed and whose occurrences can be tracked
and scalable automatic decision-making process. We consider down. Our context-aware system for IoT-based applications
context-awareness a key component of a middleware aimed for Smart Cities has been implemented, deployed, and tested
at enabling rapid development of IoT-enabled applications, for troubleshooting and monitoring purposes, within the scope
mainly for smart energy management [8]. of the IMPReSS Platform [9]. Designing and tracking context
graphs may be successfully used in order to help develop-
Manuscript received January 31, 2017; revised August 8, 2017; accepted ers, administrators, and end-users in harnessing the wealth of
August 22, 2017. Date of publication September 1, 2017; date of current information generated by IoT-based applications.
version April 10, 2018. This work was supported by the European Commission
and CNPq within the IMPReSS Project under Grant 614100. (Corresponding Summarizing, the expected key contributions of this paper
author: Carlos A. Kamienski.) are manifold, focused on the development, experimentation
C. A. Kamienski, F. F. Borelli, G. O. Biondi, I. Pinheiro, and and evaluation of context design and tracking features for
I. D. Zyrianoff are with the Federal University of ABC, Santo André
09210-580, Brazil (e-mail: cak@ufabc.edu.br; fabrizio.borelli@ufabc.edu.br; Smart Cities. We identify the need of a new context life cycle
gabriela.biondi@ufabc.edu.br; isaac.pinheiro@aluno.ufabc.edu.br; that captures some higher-level context management needs,
ivan.zyrianoff@ufabc.edu.br). such as context design, monitoring, and tracking, as well as
M. Jentsch is with Fraunhofer FIT, 53754 Sankt Augustin, Germany
(e-mail: marc.jentsch@fit.fraunhofer.de). explicitly identifying context occurrences. Based on that, we
Digital Object Identifier 10.1109/JIOT.2017.2748037 developed the concept of a context graph, where vertices are
2327-4662 c 2017 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission.
See http://www.ieee.org/publications_standards/publications/rights/index.html for more information.
688 IEEE INTERNET OF THINGS JOURNAL, VOL. 5, NO. 2, APRIL 2018

represented by context entities and the set of edges is repre- a whole for system development purposes. Although ontology-
sented by data flow (or control flow) between entities. Context based modeling and reasoning are very attractive due to high
graphs can be explicitly created in the context design phase expressiveness, there are disadvantages enough to make it
and they can be actively tracked and implicitly discovered by impractical for an operational system, where scalability is very
in the context tracking phase. Whereas the context graph is important [11]. A very common approach is using object-
the key underlying concept of our approach, its importance is oriented modeling with rule-based reasoning, which usually
leveraged when connected to context design and tracking. are seamlessly integrated in a variety of existing platforms.
In the remainder of this paper, Section II presents back- One key feature and an important application for Smart
ground and related work. Section III introduces our context Cities is smart energy management, aiming at achieving
life cycle and context graph and Section IV introduces the high efficiency by avoiding waste. Particularly in industrial-
context-aware management framework focusing on the context ized countries, where buildings account for 40% of energy
processing phase. Sections V and VI depict the two key topics usage [16], a challenging problem is how to improve occu-
of this paper, which are context design and context tracking, pant comfort and at the same time reduce energy usage [6].
respectively. In Section VII, we draw the conclusions and paths Byun and Park [5] investigated context awareness for saving
to future work. energy. Their system consists of a self-adaptive intelligent
gateway (SIG) and sensors (SIS). SIG provides service pro-
vision based on locations and SIS is used for gathering
II. BACKGROUND AND R ELATED W ORK information. For instance, when a user with a smartphone
When fully deployed, the IoT [1] will allow a huge variety enters a room, SIG is able to send a list of the manageable
of new services to be available for our society. Making cities devices and their real-time energy consumption. This system
smarter poses many technological challenges for IoT [17], big is highly focused and dependent on typical energy saving
data [12], cloud [4] among other technologies, but also pro- mechanisms from the area of wireless sensor networks, such
vides opportunities for new applications (verticals), such as as efficient energy-based routing. On the contrary, we focus
smart energy management [3]. on a higher-level context modeling approach, which allows
Context-aware systems acquire different types of informa- contexts to be actively tracked and monitored.
tion for reasoning and adapt their behavior without explicit The IMPReSS systems development platform enables rapid
user intervention [2]–[11]. Currently, with the advent of the development of context-aware mixed-criticality IoT-based
IoT and the innumerous applications in Smart Cities, context- applications [9]. IMPReSS offers a variety of components
aware management has been increasingly used within the for facilitating the development of IoT-enabled applications,
scope of big data analytics [12]–[14]. Regardless of how sen- which includes a context manager. While in [9] we briefly
sor data and other information are managed, context needs described the context manager and introduced some use
to be fully understood and carefully considered in IoT-based cases, here we elaborate on the new concepts underlying
applications in order to guarantee an effective, efficient, and the IMPReSS context-aware management framework, namely,
scalable decision-making process. We consider context aware- the context life cycle, the context graph, context design, and
ness as a key component of a middleware aimed at enabling context tracking. Also, in [7] we focused on communication
agile development of IoT-enabled applications, mainly for issues of IMPReSS, but do not elaborate on context-aware
smart energy managing [8]. management for IoT.
Due to the fact that context-aware management is not a new We consider that our high level context life cycle, the concept
subject and application scenarios evolved substantially in the of context modeling as a context graph and the resulting context
last years, we identified the need to modernize some con- design and context tracking features are novel compared to the
cepts like the context life cycle to keep theory up-to-date current state of the art. Therefore, to the best of our knowledge,
with newer hands-on experience in designing, developing, there is no similar context-aware management framework with
deploying, and evaluating related technology to the IoT realm. those features in the literature thus avoiding direct qualitative
Perera et al. [15] proposed a context life cycle management for and quantitative comparisons to be conducted.
IoT composed of four phases: 1) context acquisition; 2) mod-
eling; 3) reasoning; and 4) dissemination. Although useful,
III. C ONTEXT L IFE C YCLE AND THE C ONTEXT G RAPH
this model is data oriented and does not consider typical man-
agement activities involved in IoT systems. Our context life A. Context Life Cycle
cycle captures some higher level context management needs, Context life cycle management here refers to a higher-
such as context design, monitoring, and tracking, as well as level function-oriented view of context-awareness for IoT,
context occurrence as an important entity to be modeled and compared to a lower level data-oriented view introduced by
whose own life cycle should also be followed. Perera et al. [15]. Our context life cycle is composed of six
The key components of any context-aware system are phases, as depicted by Fig. 1.
context modeling and context reasoning. The choice of a con- • Context Design: Context design is a high-level context
text model is a very important step in any context-aware modeling approach, where entities and their relation-
system because it influences the whole system and also lim- ships are represented as a graph. The context designer is
its the choice of a context reasoning technique. Therefore, a graphical tool that allows context graphs to be explicitly
context modeling and reasoning are usually considered as specified. The importance of context design is highlighted
KAMIENSKI et al.: CONTEXT DESIGN AND TRACKING FOR IoT-BASED ENERGY MANAGEMENT IN SMART CITIES 689

Fig. 2. Context entities and relationships.

Fig. 1. Context life cycle for IoT-based Smart Cities.

B. Context Entities
in our life cycle because it helps administrators to follow
We identified six essential entities for modeling typical
and understand context occurrences.
IoT-based context-aware management applications: resource
• Context Editing: Context entities must be stored in the
(sensors and actuators), place (buildings, rooms, floors), fusion
context storage in order to be available for context pro-
(sensor data aggregation), rule (context reasoning), action
cessing. Performing [create, read, update, delete (CRUD)
(commands to actuators), and context (combination of place,
operations on context entities] is a straightforward but
resource, fusion, rule, and action). Those entities were cho-
necessary feature. As a matter of fact, context design
sen specifically for smart energy management systems [8].
can be understood as a special way of editing contexts,
Other models for different applications might result in slightly
modeled, and visualized as a context graph.
different sets of entities.
• Context Occurrence: Contexts occur when they undergo
Fig. 2 depicts the relationships among these entities.
a process that starts with data coming from sen-
• Place has Resource: Sensors and actuators are physically
sors (resources), being transformed by fusion, firing a rule
located in places.
for taking a decision that executes actions with commands
• Resource Feeds Fusion: Fusion criteria combines
for actuators (resources). In other words, contexts occur
data coming from sensors.
when an instance of the related context graph is activated
• Fusion Fires Rule: Rules are fired by fusion criteria.
by data flow. The concept of context provides a more
• Rule Binds to Place: Rules are bound to places, for
precise understanding of the dynamics involved in the
ensuring locality of effect.
process of adapting system behavior.
• Rule Performs Action: When a rule is fired, it performs
• Context Processing: Context occurrences are handled
one or more actions.
by system components in charge of context process-
• Action Changes Resource: Actions send commands to
ing that include the usual phases of context acquisition
change the state of actuators, thus adapting the application
(sensor data gathering), sensor data fusion, context rea-
to current environmental conditions.
soning, and dissemination (commands sent to actuators).
• Context Contains Entities: Context contains place,
In other words, context processing is the result of context
resource, fusion, rule, and action. Contexts can contain
occurrences.
other contexts in a nested way as indicated by Fig. 2.
• Context Tracking: When contexts occur and are pro-
cessed, they are logged and leave a trail in the system,
which can be tracked down. For example, a variety of
devices may have their states automatically changed by C. Context Graph
a context-aware application and system administrators Context is a container entity, i.e., it comprises a set of
must be able to understand what happened. Context track- instances of other entities. The use of contexts is important for
ing has two fundamental goals. First, it identifies that modeling and documentation purposes. Contexts model situa-
certain contexts explicitly designed occurred in practice. tions of real life, such as empty building, occupied classroom,
Second, it identifies contexts that occurred but were not idle elevator, or closed university. Whereas nouns in these
initially conceived during the design phase. examples are represented by places, verbs need a combination
• Context Monitoring: Contexts are edited and designed, of other entities to be meaningful. For example, a university
contexts occur, contexts are processed, contexts are may determine that whenever a classroom is empty, lights must
tracked and finally contexts are stored. In order to be switched off and air conditioners (or heaters) must be turned
understand what happened in a context-aware system off. Determining whether a classroom is empty may involve
for performance auditing and troubleshooting activities, different presence sensors placed in strategic positions within
contexts must also be actively monitored. a classroom and the values will be averaged. Also, when all
• Context Storage: Context storage stores data of the con- presence sensors indicate that a classroom is empty, a rule will
text entities, in addition to log information. The latter is be fired that in turn executes two actions for switching lights
used for many purposes, including context tracking. off and turning air conditioners off.
690 IEEE INTERNET OF THINGS JOURNAL, VOL. 5, NO. 2, APRIL 2018

(a)
Fig. 4. Nested contexts using a context as a virtual sensor: empty floor is
defined based upon three empty room contexts.

step, representing whether they occurred or not. For example,


an empty building context can be created upon a combination
of empty floor 1, empty floor 2, and empty floor n contexts.
In turn, empty floor 1 is also a combination of other contexts,
(b) such as empty room 11, empty room 12, and empty room 1n.
If the purpose is to switch off all lights in a building, one just
Fig. 3. Context graph (a) simple four-step (sensor/fusion/rule/actuator) con- needs to activate the context empty building and all contexts
text graph. (b) Context graph with nested fusions. The anchor represents that related to it will be automatically activated. In the absence of
contexts are tied in a place by the rule, which is unique in a context.
this feature, all constituent contexts will have to be activated
individually.
Contexts are nonbinding when it comes to the execution Fig. 4 depicts the feature of nesting contexts and repre-
of particular instances of their constituent entities. In practice sents an empty floor context using a logical AND operation.
a context may occur in unpredictable ways, due to the asyn- Different contexts can be defined using empty room, such as
chronous nature of rule-based reasoning and of the randomness number of occupied room that negates the output of empty
of real world situations. room and sums all values in the fusion step.
Contexts are modeled as directed acyclic graphs, where the
set of vertices is represented by entities and the set of edges
is by data flow or control flow among entities. The same con- D. Explicit and Implicit Context Occurrence
text graph can be applied to different places in a process of Considering the asynchronous and independent behavior
instantiation of a generic graph. In that case, the place entity of entities, contexts can occur in predictable or unpre-
is used to determine, where that graph is anchored. dictable ways. Predictable context occurrences are obviously
Fig. 3 depicts two examples of context graphs. the expected and preferred way of dealing with automatic sys-
Fig. 3(a) depicts a simple context graph with the enti- tem changes. However, since combinations that differ from
ties resource, fusion, rule, and action. Raw data measured the intended prespecified contexts can occur in practice, any
by sensors (resource) is fed into an average calculation context management system must be designed to deal with
process (fusion), whose result is in turn fed into a reasoning unpredictable context occurrences for monitoring, validation,
step (rule) that determines whether commands should be and troubleshooting purposes. This happens because users
sent to actuators to change their behavior (action). The do not always have a clear understanding of the interac-
Place entity is a different type of vertex with only control tion between multiple instances of different entities, such as
flow information involved, but not data flow. Therefore, it resources, fusion, rules, and actions.
is represented in a different color and the edge is a dashed In a real world environment, different combinations can
line. The rule entity is “anchored” in the place entity, which happen in a system, which can puzzle administrators, integra-
means that since there is only one rule in a context graph, all tors and end-users when the system makes counter-intuitive
other entities are also anchored in that place. A fusion step changes to the environment. When creating a rule for context
may be deemed as a virtual sensor, so that multiple nested reasoning, administrators might consider a certain class of sen-
fusions may be connected in sequence, as in Fig. 3(b). This sors, but depending on how the rules are actually written, they
recursive connection of fusion steps gives us higher flexibility may catch other data that were not originally conceived to be
in modeling the operation of contexts in a real scenario. handled by them. As a consequence, unexpected, inconvenient,
Contexts can be self-related, i.e., they can be used as a vir- or even harmful actions might happen. For example, scheduled
tual sensor and nested inside each other, thus helping this events can be easily generated by creating virtual sensors that
approach to achieve scalability by allowing context reuse. This send data signaling the beginning and end of an event, such
is performed by generating an additional output for signaling as a meeting that takes place in a certain meeting room. It
the execution of rules in the form of a binary value. Whenever is straightforward to observe that in that situation scheduled
rules are fired, there is an output value of “1,” and otherwise events can be mixed up with on-demand events (people enter-
the output is “0.” Thus, contexts can make arithmetic and log- ing or leaving the room) and certain unplanned combinations
ical (Boolean) operations upon other contexts in the fusion of context entities might actually occur.
KAMIENSKI et al.: CONTEXT DESIGN AND TRACKING FOR IoT-BASED ENERGY MANAGEMENT IN SMART CITIES 691

Fig. 5. Explicit and implicit context occurrences.

Fig. 6. Context-aware management framework architecture for IoT-based


Fig. 5 depicts the two ways of creating contexts. energy management systems for Smart Cities.
1) Contexts can be explicitly created using the context
designer with an expectation that they will occur in
a predictable way afterwards, but they might never occur
in practice.
2) Contexts can be implicitly discovered and created by the
context tracker after they occurred in an unpredictable
way.
The context tracker also counts the number of occurrences
of any particular context, both explicitly and implicitly cre-
ated. After a context is implicitly discovered and created by
the context tracker, it does not differ from its explicit counter-
part and it can be viewed, updated, and deleted by the context
Fig. 7. Relational model of the context storage.
designer. Finally, the context monitor is a tool within the con-
text modeler that allows users to follow contexts that occurred,
either explicitly designed or implicitly discovered.
As an illustration of explicit and implicit contexts, let us context-aware framework was developed for the IMPReSS
assume the existence of an explicit scheduled classroom in project, it can be used as an independent software platform.
a university that switches lights on and turns air conditioning Fig. 6 highlights context design and context tracking, which
(or heaters) on 10 min before a class starts. It does the opposite will be further elaborated in the following sections.
10 min after the class finishes. A professor switches her classes The context manager provides features of context acqui-
to the laboratory and does not tell the administration. Also, sition, reasoning, and tracking, as well as algorithms for
there is a rule that whenever the absence of people inside sensor data fusion [8]. Two main design choices guided the
a classroom for more than 15 min is detected, lights, and other technological choices: object-oriented context modeling and
devices must be turned off. It turns out that the classroom rule-based context reasoning. Some very mature underly-
will not be prepared for classes during the whole scheduled ing technologies exist, such as persistence storage and rule
period. The context tracker will track all executed actions and engines. These are based on the object-oriented approach. In
identify the existence of an implicit context that has not been addition, rule-based reasoning is commonly used and offers
planned. Thus, an administrator can check the reason that this different existing tools that integrate with object-oriented
classroom is not used and contact the professor to perform programming languages.
whatever action they see fit, such as creating a specific context The data fuser receives sensor data from the communicator
for dealing with that situation. and uses a set of techniques for combining data from multiple
sources or computing statistics. Whenever fusion criteria are
met, it activates the reasoner that infers logical consequences
IV. C ONTEXT-AWARE M ANAGEMENT F RAMEWORK from a set of facts, by searching the entire set of rules for
Our context-aware management framework architecture a match. As a result, one or more actions are performed
(Fig. 6) is divided into two major components linked by which send commands to actuators. Finally, the communicator
a communication interface, which are context modeler, context encapsulates communication with sensors and actuators.
manager, and context API, respectively. The context manager The context storage deals with context entity templates.
is divided into components that deal with context process- A relational database is used for storing entity information
ing, context occurrence, context tracking, and context storage. (Fig. 7), but not for sensor data that is better dealt with by
The context modeler is divided into components that deal with NoSQL databases. Here, an explanation regarding the use of
context design, context editing, and context monitoring. The a relational model in IoT is needed, since current solutions
context API is a Web services REST interface that allows usually are based on NoSQL. A key feature of our strategy is
applications, such as the context modeler to interact with the providing means for users to track and monitor contexts, as
context manager, but also other context user interfaces and they occur in a normal execution of a system. In order to keep
other components of the IMPReSS system [9]. Although our all information needed for context tracking purposes, we must
692 IEEE INTERNET OF THINGS JOURNAL, VOL. 5, NO. 2, APRIL 2018

TABLE I
S MART E NERGY M ANAGEMENT: RULES AND ACTIONS

Fig. 8. Context design scenario: smart energy management in classroom


A-112.

be able to refer entities to each other. A relational database


with foreign keys and integrity features was considered best
fitted to achieving that end.
Our relational model is divided into three categories:
1) entity; 2) relationship; and 3) log, represented in Fig. 7 in
dark blue, light blue, and orange, respectively. Tables belong-
ing to the entity category represent the context entities depicted
in Fig. 2. Tables belonging to the relationship category are
associative entities, used to maintain integrity among different
entity tables. Finally, tables belonging to the log category keep
log information for tracking and auditing purposes. Both place
and context entities have self-relationships in order to provide Fig. 9. Context graph for the context design scenario.
scalability by nesting entities inside each other.
We use rule R4 (highlighted in Table I) to depict the context
design feature, which turns light L1 on (row 1) and turns lights
V. C ONTEXT D ESIGN L2–L4 off. In order to guarantee that presence is detected only
Context design is performed by a component that exposes in row 1, among ultrasonic sensors only sensor U1 must report
a graphical user interface called context modeler. This compo- presence (i.e., U1 = 1 and U2 = U3 = U4 = 0) and for Kinect
nent is also responsible for context editing and monitoring. In sensors, only K1 must detect presence in its right row (i.e.,
order to demonstrate the features of context design, we will K1 = 01 and K2 = 00).
adopt a scenario of energy saving in a university classroom Fig. 9 depicts a graphical view of the context graph that
(borrowed from [9]). Fig. 8 represents a simplified classroom must be modeled in the context designer. Rule R4 was adapted
with four rows and four individual lights (L1–L4), four ultra- to include two fusion steps in order to relieve the reasoner
sonic presence sensors (U1–U4), and two Kinect sensors (K1 from a high processing burden by reducing the complexity of
and K2). There is one ultrasonic sensors installed per row and the rules. Therefore, the first fusion step implements a con-
two Kinect sensors each two rows since they have a wider catenation of bits (II) for both ultrasonic and Kinect sensors
angle. We use both ultrasonic and Kinect sensors to improve and the second one implements a logical AND operation (∧).
presence detection and decrease false positives. We deployed This example follows exactly the condition of R4 so that the
such scenario in a real setting for demonstration and evaluation actions will be sent to actuators in order to only keep light
purposes. L1 switched on.
Table I depicts an example of five rules used in this sce- Fig. 10 depicts a context graph as it appears in the con-
nario to switch lights on and off according to the presence text designer, modeling the same context illustrated in Fig. 9,
of students in specific rows of the classroom. The rationale except that the place entity is not represented within the graph,
for this example is that if back rows are empty, lights can but as its attribute. The context designer can add sensors, actu-
be automatically turned on but whenever there is at least one ators, fusion, and rules, where actions are specified together
student in a certain row, all lights from that row frontwards with rules, since their execution is a direct result of a rule
are turned on. Ultrasonic sensors report presence of students being fired. Since actions for switching lights on and off are
in a row as 1 and absence as 0, whereas Kinect sensors detect already linked to rule R4, whenever R4 is fired, commands
presence in two rows at once and therefore after passing by are sent to the actuators L1–L4.
the data fusion step they arrive at the Reasoner as two bits: Using the context copy feature of the context modeler, con-
00, 01, 10, and 11. For example, 01 means that at least one texts can be easily replicated to provide scalability to the
student was detected in the right side but no one was detected context design approach. For example, universities usually
in the left side. Presence in a row must be detected by both have a high number of similar classrooms in terms of size and
ultrasonic and Kinect sensors in order for lights to be turned layout. Administrators can create one instance of an empty
ON from that row frontwards. classroom context and replicate it to all similar classrooms.
KAMIENSKI et al.: CONTEXT DESIGN AND TRACKING FOR IoT-BASED ENERGY MANAGEMENT IN SMART CITIES 693

Fig. 11. Context tracker.

Fig. 10. Context designer—context graph for switching light L1 ON.

Even though every classroom has a different set of resources


(sensors and actuators) they can be automatically detected
by the IMPReSS resource discovery component and tagged
with the place, where they are located [7]. Currently, there
are different proposals for dealing with automated labeling (or
naming) schemes for sensors, such as similarity finding based
on linguistic and semantic techniques [16]. Therefore, when-
ever a new context is replicated by the context copy function,
it can find resources of the same type in both the source and
target classrooms and match the discovered resources with the
newly created one. In our current proof-of-concept prototype,
this feature is not yet available due to the lack of a real sce-
nario for deployment and testing purposes. Nevertheless, we
consider it conceptually simple and feasible from a software
Fig. 12. Context tracking algorithm.
development perspective since IMPReSS provides resource
discovery features. Nested contexts (Section III-C) also pro-
vide scalability to the context design approach, by allowing The context tracker runs periodically as a batch process
the use of contexts as virtual sensors and thus using a context and always starts by finding actions executed since its last
inside another context. execution. It reads all actions one by one and finds a rule,
fusions, sensors, and actuators associated to them. One con-
text occurrence (and related context graph) can have many
VI. C ONTEXT T RACKING nested fusions, so that the tracker recursively finds all fusions
Context tracking leverages context logging, which plays an and with the set of fusions finds all sensors that fed data into
important role for auditing purposes, but it also helps users them. Whenever a context execution is detected, the tracker
to understand which contexts are being executed, given a set checks in the context storage if this context exists, either an
of places, resources (sensors and actuators), fusion, rules, and explicitly created or a previously implicitly discovered one. In
actions. Context tracking does not simply consist of finding the case this detected context is found in the storage, it increases
execution of a single entity a posteriori, but provides features its count information and updates the timestamp. Otherwise,
for helping users to understand and monitor which contexts are a new implicit context is created.
being executed in practice. Even though context graphs can be Fig. 12 depicts the high-level algorithm used by the con-
specified by the context designer, contexts may be executed in text tracker. The tracking algorithm receives a time interval
unpredictable ways. Some contexts occur in the exact way they as input, consisting of the initial and final timestamp of the
were initially defined (i.e., they are explicitly created), whereas actions that started a context occurrence. In line 5, the algo-
other contexts may happen in unexpected ways without users rithm loops over all actions within that interval, obtained in
being aware of them (i.e., they are implicitly discovered). line 4. In lines 6–8, it finds all rules, actuators, and fusions
The context tracker follows traces of context occurrences related to each action and after that it calls a function to
stored in the context storage, as depicted by Fig. 11. The obtain all nested fusions recursively (lines 16–22). The result
communicator, fuser, and reasoner components of the context of a fusion might become a virtual sensor, which in turn may
manager store sensor data, fusion criteria, rules, and actions be fed into another fusion. Tracking such nested fusions needs
to actuators as shown by the top part of Fig. 11. a recursive function for guaranteeing that no matter how many
694 IEEE INTERNET OF THINGS JOURNAL, VOL. 5, NO. 2, APRIL 2018

generate data that creates 2000 contexts per minute, which can
be processed by the context tracker according to Fig. 13. On
demand sensors, on the other hand, generate data at irregular
periods, whenever certain events occurs for changing certain
behaviors. This type of sensor typically will not pose scala-
bility constraints because it will be able to process in batch
after the event is finished.
In addition, we have to consider that the hardware used in
the experiments is not top notch and that the context tracker
is highly parallelized because of the query structure of the
Fig. 13. Context tracker performance. tracking algorithm, but we only used a single processing core.
Therefore, if we consider a high end CPU, such as Intel Xeon
E5-2679 v4 with 20 cores, one can easily see that the context
nested fusions exist, all of them will be tracked back reaching tracker can handle more than 10 million (or even 20 million)
the sensors. In line 11, it makes a new context out of rule, time-driven sensors in one minute.
fusions, and resources (sensors and actuators).
In a real scenario, the context tracker will need to process VII. C ONCLUSION
a large number of contexts in a small time period, which might Context-aware systems are key resources for making sense
pose constraints on its use. In order to understand the scalabil- of the myriad of information generated by a multitude of
ity of the context tracker, we conducted a performance analysis sensors in any IoT-based application for Smart Cities. They
study and for that purpose we populated the database shown allow applications to adapt behavior automatically according
in Fig. 7 with synthetic data. We considered a scenario, where to changes in the current environment conditions. Our context-
each sensor sends data that goes through fusion, rule, and aware management framework identifies many components
action entities. This is the worst-case scenario because every needed for such a system in a smart energy application, partic-
single data sent by a sensor generates a new context. ularly the context graph, the context designer, and the context
All tables depicted in Fig. 7 were populated with data rep- tracker.
resenting entities that make up a context as depicted in This framework has been implemented, deployed and tested
Figs. 2 and 3. Tables representing entities obviously have in different situations, including troubleshooting, demonstra-
to be populated, but also relationship tables are necessary, tion, reviewing, and performance analysis purposes. Our expe-
such as FUSION_RULE. Also, auxiliary tables that are not in rience makes us believe that using context graphs that can
Fig. 7 were also populated, such as PLACE_TYPE. Finally, be designed and tracked might be successfully used in future
log tables are necessary for identifying that contexts were exe- systems in order to help developers, administrators, and end-
cuted, such as RULE_ACTION_LOG that is, where the tracker users to harness the wealth of information generated by highly
starts looking for contexts according to Fig. 11. scalable IoT systems.
Using this methodology, the context tracker was executed As future work, we intend to broaden the scope of the
30 times for 1, 10, 100, 1000, and 10 000 contexts and the context-aware framework for different applications of Smart
average result of the 30 replications is depicted in Fig. 13. 99% Cities, which may require additional context entities. Also,
asymptotic confidence intervals were computed, but they are we will test different implementations of the context man-
not shown in the chart because the values are insignificantly ager, varying the data architecture for grasping a better
small. The chart is in a logarithmic scale and clearly shows understanding on limits of scalability.
that the tracker running time grows linearly with the number
of contexts. For these experiments, with a relatively old and
R EFERENCES
modest hardware configuration, 10 000 contexts can be pro-
cessed in less than 5 min (268.55 s). In our experiments we [1] L. Atzoria, A. Ierab, and G. Morabitoc, “The Internet of Things:
A survey,” Comput. Netw., vol. 54, no. 15, pp. 2787–2805, Oct. 2010.
used a dedicated server based on Intel Xeon CPU E3-1240 V2 [2] M. Baldauf, S. Dustdar, and F. Rosenberg, “A survey on context-aware
3.40 GHz with 8 GB RAM. systems,” Int. J. Ad Hoc Ubiquitous Comput., vol. 2, no. 4, pp. 263–277,
Considering the context tracker processing times shown in 2007.
[3] E. Borgia, “The Internet of Things vision: Key features, applications and
Fig. 13, let us understand how many sensors it is able to han- open issues,” Comput. Commun., vol. 54, no. 1, pp. 1–31, Dec. 2014.
dle in a certain time period. For the Padova Smart City project, [4] A. Botta, W. de Donato, V. Persico, and A. Pescapé, “Integration of cloud
Zanella et al. [17] identified two types of sensors: 1) those that computing and Internet of Things: A survey,” Future Gener. Comput.
Syst., vol. 56, pp. 684–700, Mar. 2016.
generate data constantly in spaced time periods and 2) those [5] J. Byun and S. Park, “Development of a self-adapting intelligent sys-
that generate data on demand according to particular events. tem for building energy saving and context-aware smart services,” IEEE
The worst-case scenario for time-driven sensors in Padova is Trans. Consum. Electron., vol. 57, no. 1, pp. 90–98, Feb. 2011.
[6] B. Campbell and P. Dutta, “An energy-harvesting sensor architecture and
to send one data packet every 10 min. Also, a context is only toolkit for building monitoring and event detection,” in Proc. 1st ACM
created when a rule is fired, i.e., a given behavior is only Int. Conf. Embedded Syst. Energy Efficient Build. (BuildSys), Memphis,
changed under certain circumstances. Using a very conserva- TN, USA, Nov. 2014, pp. 100–109.
[7] E. Ferrera et al., “XMPP-based infrastructure for IoT network man-
tive estimate that a context is created 5% of the times a sensor agement and rapid services and applications development,” Ann.
data is sent, a simple calculation shows us that 400 000 sensors Telecommun., vol. 72, nos. 7–8, pp. 443–457, Aug. 2017.
KAMIENSKI et al.: CONTEXT DESIGN AND TRACKING FOR IoT-BASED ENERGY MANAGEMENT IN SMART CITIES 695

[8] C. Kamienski et al., “Context-aware energy efficiency management for Gabriela O. Biondi received the B.S. degree in
smart buildings,” in Proc. IEEE World Forum Internet Things (WF IoT), computer science from the Centro Universitário
Milan, Italy, Dec. 2015, pp. 699–704. da FEI, São Bernardo do Campo, Brazil, in 2011,
[9] C. Kamienski et al., “Application development for the Internet of and the M.S. degree in computer science from the
Things: A context-aware mixed criticality systems development plat- Federal University of ABC, Santo André, Brazil, in
form,” Comput. Commun., vol. 104, pp. 1–16, May 2017. 2013, researching with data mining. She is currently
[10] A. I. Maarala, X. Su, and J. Riekki, “Semantic reasoning for context- pursuing the Ph.D. degree in information engineer-
aware Internet of Things applications,” IEEE Internet Things J., vol. 4, ing at the NUVEM Strategic Research Unit, Federal
no. 2, pp. 461–473, Apr. 2017. University of ABC.
[11] P. Makris, D. N. Skoutas, and C. Skianis, “A survey on context-aware She is a Research Fellow of the NUVEM Strategic
mobile and wireless networking: On networking and computing envi- Research Unit, researching with data models and
ronments’ integration,” IEEE Commun. Surveys Tuts., vol. 15, no. 1, technologies for IoT for Smart Cities. From 2013 to 2016, she performed
pp. 362–386, 1st Quart., 2013. research on the IMPReSS project. She has been an instructor of different
[12] M. V. Moreno et al., “Applicability of big data techniques to smart cities courses in ICT, since 2008, and she has been a Lecturer with the Faculdade
deployments,” IEEE Trans. Ind. Informat., vol. 13, no. 2, pp. 800–809, das Américas, Fortaleza, Brazil, since 2015.
Apr. 2017.
[13] E. F. Nakamura, A. A. F. Loureiro, and A. C. Frery, “Information fusion
for wireless sensor networks: Methods, models, and classifications,”
ACM Comput. Surveys, vol. 39, no. 3, 2007, Art. no. 9.
[14] E. A. Nuaimi, H. A. Neyadi, N. Mohamed, and J. Al-Jaroodi,
“Applications of big data to smart cities,” J. Internet Services Appl.,
vol. 6, p. 25, Dec. 2015.
[15] C. Perera, A. Zaslavsky, P. Christen, and D. Georgakopoulos, “Context
aware computing for the Internet of Things: A survey,” IEEE Commun.
Surveys Tuts., vol. 16, no. 1, pp. 414–454, 1st Quart., 2014.
[16] A. Schumann, J. Ploennigs, and B. Gorman, “Towards automating the
deployment of energy saving approaches in buildings,” in Proc. 1st ACM Isaac Pinheiro is currently pursuing the B.S. degree
Int. Conf. Embedded Syst. Energy Efficient Build. (BuildSys), Memphis, in computer science with the Federal University of
TN, USA, Nov. 2014, pp. 164–167. ABC, Santo André, Brazil.
[17] A. Zanella, N. Bui, A. Castellani, L. Vangelista, and M. Zorzi, “Internet From 2013 to 2016, he was involved with research
of Things for smart cities,” IEEE Internet Things J., vol. 1, no. 1, on the IMPReSS project. He has been researching
pp. 22–32, Feb. 2014. for many years with development of Web backend
applications. His current research interests include
computer networks, Internet of Things (IoT), and
software development for the IoT.

Carlos A. Kamienski (M’07) received the B.S.


degree in computer science from the Federal
University of Santa Catarina, Florianópolis, Brazil,
in 1989, the M.S. degree from the State University
of Campinas, Campinas, Brazil, in 1994, and the
Ph.D. degree in computer science from the Federal Ivan D. Zyrianoff received the B.S. degree in sci-
University of Pernambuco, Recife, Brazil, in 2003. ence and technology from the Federal University of
He is a Full Professor of computer science with ABC, Santo André, Brazil, in 2016, where he is cur-
the Federal University of ABC, Santo André, Brazil, rently pursuing the B.S. degree in computer science
where he currently holds the positions of the Head of and the master’s degree in information engineering.
International Relations and the Head of the NUVEM From 2014 to 2016, he was involved with research
Strategic Research Group. His current research interests include Internet of on the IMPReSS project. He is a Research Fellow
Things, Smart Cities, network softwarization, and cloud/fog computing. of the NUVEM Strategic Research Unit, researching
the Internet of Things and fog computing.

Fabrizio F. Borelli received the B.S. degree in


science and technology, B.S. degree in computer sci-
ence, and M.S. degree in computer science from the
Marc Jentsch received the Diploma degree in geoin-
Federal University of ABC, Santo André, Brazil,
formatics from the University of Münster, Münster,
in 2011 and 2013, respectively, researched with
Germany, and the Ph.D. degree in computer sci-
bioinformatics and HPC (GPUs). He is currently
ence from the RWTH Aachen University, Aachen,
pursuing the Ph.D. degree in information engineer-
Germany.
ing at the NUVEM Strategic Research Unit, Federal
He is currently a Research Fellow with the
University of ABC.
Fraunhofer FIT Research Center, Sankt Augustin,
From 2013 to 2016, he was involved with research
Germany, where he coordinated the IMPReSS
on the IMPReSS project. He is a Research Fellow
project.
with the NUVEM Strategic Research Unit, researching with software and
data architectures for application development in IoT for Smart Cities.

Вам также может понравиться