<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Kamille Gusmanov, Kevin Khanda, Dilshat Salikhov, Manuel Mazzara, Nikolaos Mavridis</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Innopolis University</institution>
          ,
          <addr-line>Innopolis</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Smart Buildings; Internet of Things; Energy Management; Microservices; Jolie; Distributed Architectures; Concurrent Applications; Cloud Computing</institution>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2016</year>
      </pub-date>
      <fpage>200</fpage>
      <lpage>207</lpage>
      <abstract>
        <p />
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>INTRODUCTION</title>
      <p>
        as: “a global infrastructure for the information society, enabling advanced services by interconnecting
(physical and virtual) things based on existing and evolving interoperable information and communication
technologies.” One such important category of physical things are buildings; functioning either as human
habitats, for the case of domestic buildings, or specialized towards many other goals, as is the case for
storehouses, shops, industrial buildings, schools, and much more. There are multiple aspects of the
operation of modern-day buildings that afford further automation and optimization: for example, it has been
shown that the benefits of better energy management through automation can be very high [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]; also, the
security of buildings, their human-friendliness and adaptation to preferences can be vastly improved, not to
mention other aspects. Thus, smart buildings, as well as their wider container of smart cities, are not only
significant research topics for today, but also promise to improve our lives and increase sustainability,
starting in the near future.
      </p>
      <p>Traditionally, most building automation systems were made for specific applications and offered
little degree of openness and flexibility. However, with the fast maturation of a number of supporting
technologies, the opportunity to change this status quo is rapidly growing. First, cheap sensing and
perception technologies have become available for a wide range of measurables: covering not only physical
properties of the building and its spaces, such as temperature, light, and humidity, but also providing
information about the presence, number, identities, activities, and even emotional states of the people inside
a building or in its surrounding spaces. Second, affordable and miniature microprocessor-based platforms
have become widespread and are easily inter-connectable to sensors, which often have enough processing
power to support perception and machine vision; with multiple network transports, even the necessary
small battery power is readily available. Third, networking technology for such platforms has advanced
significantly, and nowadays it is easy to implement building-wide networks, often with dynamic ad-hoc
topologies, which also support on-the-fly introduction and replacement of new nodes, while providing
secure communications. Fourth, special languages and middleware has been developed, in order to support
straightforward development of distributed systems based around a number of paradigms, including
microservices.</p>
      <p>Given these developments, one cannot only envision, but can also start implementing and
experimenting with, the usage of the IoT for providing generic smart building infrastructure. Such an
infrastructure would go beyond the constraints of existing specialized systems, and could provide fluid
support for diverse concurrent applications, which would effectively share the resources of the
infrastructure, and which would operate through microservices provided by the nodes. Furthermore,
infrastructure such as the “Jolie Good Buildings” that we present here, promises strong scalability, reliability,
and upgradability as more powerful hardware becomes available. Yet another important advantage of our
system, is its support for the direct utilization of the immense power of external services available on the
wider internet, beyond its own hardware, as part of the distributed applications running on its nodes.</p>
      <p>In this paper, we will start by providing background on relevant existing work. Then, we will present
the overall architecture of our system and will explain the requirements and design choices made. We will
then present results, discuss current and future steps, and finish with a forward-looking conclusion. We
hope that this work will help create a future, in which not only resources are saved and the environment
protected, but also human life becomes less stressful with enhanced efficiency and creativity.</p>
    </sec>
    <sec id="sec-2">
      <title>BACKGROUND</title>
      <p>
        The Internet of Things (IoT) promises to become an integral and important part of our future. At
the moment, the number of connected devices is greater than the estimate of 22 billion [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], which is several
times greater than the number of Earth’s inhabitants. However, one of the problems that arises is the
existence of many different types of incompatibilities among devices, prohibiting fluid interoperability,
when in many cases what is needed for specific applications is already available in distributed form around
the IoT. For example, consider the kinds of information one can get from a fitness tracker device: using the
accelerometer and gyroscope, one can get information about whether the person wearing the device is now
running, walking, eating or swimming in a pool. However, the most important issue is the ability to integrate
this information with other information existing in other sources. For example, on the basis of data from a
heart rate sensor, as combined with fitness tracking information and personal data, a smart application
could start assessing the health condition of an individual, and if required, suggesting various treatments.
Also, such information could also be very useful for professional doctors - a physician could utilize such
extensive and detailed historical data effectively: understanding the temporal trajectory of a health issue,
the frequency of observable problems etc.
      </p>
      <p>
        The IoT can be envisioned to be useful in almost all spheres of human life. In our project we consider
the theme of Smart Buildings and Human-Building Interaction. There have been many different studies on
this topic, which utilize various kinds of sensors, software architectures and, sometimes also include robots.
The creation of a single and simple platform that can handle a large variety of types of sensors and even
robots is a very important step towards the development of Smart Buildings. It should be noted that Cloud
Computing (CC) could also play a beneficial role in such systems. In the words of [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]: “In cloud computing,
computation is viewed as a "utility". In a similar sense with modern power and water networks, cloud users
do not need to own the means of production or distribution (i.e. power generators, water sources and
distribution networks); they just connect to the cloud, and time-share reusable distant distributed
computation, storage, and code resources that become available in a transparent fashion (not knowing the
whereabouts or the specifics of them) and with high robustness.”. Yet, traditional Cloud Computing also has
a number of limitations. One of them is that “it is not effectively connected to the physical world in the way
that a situated robotic agent would be” [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], and this is a prime motivation for the introduction of the concept
of the Human-Machine cloud, which goes beyond platform-as-a-service, code-as-a-service, and
storage-asa-service, by including sensing, cognition, and actuation services, provided through both humans and
machines.
      </p>
      <p>
        A further stage of the development of the system of Smart Buildings is to design effective interaction
between humans and smart buildings. A concise overview of some relevant research can be found in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
Furthermore, an initial example of a framework for human-machine cloud services can towards smart
buildings, can be found in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
      </p>
      <p>
        Microservices can be very useful towards the IoT. Microservice software architecture is a style for
service-oriented development whose popularity is increasing now because of growing interest to parallel
and distributed computation. Designed and built especially towards microservices, the Jolie programming
language [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] was developed to work directly with a service-oriented paradigm, which distinguishes it from
other popular languages like C#, Java, or Python. This means that the language contains features that are
unique to this approach, i.e. example representation of building blocks. In object-oriented languages, there
are usually classes or functions; in Jolie, the building blocks are a service in their own right.
      </p>
    </sec>
    <sec id="sec-3">
      <title>ARCHITECTURE</title>
      <p>In this stage, the main goal was to create a small and simple system, where the biggest part of the
work was assigned to Jolie (Figure 1). All process was divided by steps and as the result the goal was
achieved.</p>
      <p>The first step was connecting and configuring sensors through BLE. The main data collected for
temperature, humidity and luminance were made using CC2650 SensorTag because they have the necessary
sensors, small size, run on batteries, and easy code to write. The work with sensors are very similar to the
creation of the sketches for Arduino: C code is written with the necessary libraries for the SensorTag, sensors
to be used, and ways of exchanging information with these devices. In our case, data is sent via BLE, as it is
very easy to use and configure.</p>
      <p>
        The door sensor from Aeon Labs, which works on the protocol Z-Wave, was used to create a
monitoring system entrance/exit to the premises. To work with this device, HomeOS[
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] was used, which is
written in the programming language C# and has the necessary functionality to work with the devices of
this company in the protocol Z-Wave.
      </p>
      <p>The next step was to writing simple code to work with the sensors in Jolie. What are the advantages
of using Jolie? The most interesting opportunity that we receive is code reusability. Because our system will
support different types of sensors, the main logic of their connectivity and data extraction is similar for most
of them. Also, product support becomes easier: this is reusability. The same service can be used for these
sensors. Implied by the first advantage, the second advantage is reducing bugs. A third advantage that may
be interesting for future collaborators is simplicity. Jolie divides all system logic into small parts: we have
several services that are responsible for each sensor or each action, the naming of each block is intuitively
understandable, so these language features increase code readability. In addition, one more significant
advantage is working with Java code in Jolie. Thus, the part of the work with getting data from BLE devices
was written in the Java programming language and divided into simple functions, e.g. connecting to devices
and data retrieval, which is called from Jolie. Thus, the code is easy to read, clear, and ready for further work
as a client for other sensors.</p>
      <p>The last step is data collection. From SensorTags, we read data about room temperature, humidity
and light. All of them were recorded in .csv format for later processing and graphing in Python. Data from
Aeon Labs sensor is the number of opening/closing doors and monitoring incoming/outgoing people using
the webcam, which recorded in .csv and .jpg format respectively. It is also worth noting that all codes worked
in Raspberry Pi, which has all necessary libraries and connections.</p>
      <p>Despite its apparent simplicity, there were several issues at work with devices. The first serious
problem was the lack of libraries for Java to work with BLE devices. But we found a great and simple library
for Intel Edison devices and used it. The next issue was working with Z-Wave devices in HomeOS, which
periodically generated exceptions and did not connect to the device. However, all these problems were
solved, which allowed us to come to the result, which will be described in the next section.</p>
    </sec>
    <sec id="sec-4">
      <title>RESULTS</title>
      <p>We have developed a platform to work with the SensorTags based on Jolie and Java programming
languages. Despite its small size, it obtained most of the data, with which we work. The ability to embed Java
code allows the possibility to add necessary functions and give more functionality and usability to Jolie
language. At this stage, our goal was to build the basic functionality of working with sensors, understanding
how they work and how to interact with them and get ideas for the further development of the project. As a
check on the performance, we have placed sensors in
two rooms – in the student’s room in the dormitory and in the laboratory, in which we spend most time of
the day. It is worth noting that both rooms can be ventilated and fitted with lights, heaters, special motors
and actuation mechanisms to control air flow and solar illumination etc.</p>
      <p>In the room of the student, we set the Raspberry Pi with the connected Bluetooth adapter and the
SensorTag to obtain data on the temperature. For tracking of location of the student in the room, we used
data from a fitness-tracker MiBand2, using its mac address. Since the room is small, then we could accurately
determine when the student arrives
and when he leaves. Based on this dataset was constructed a graph of the temperature in the room (Figure
2, 3), which will later be used to make up the optimal temperature in the room of the student.</p>
      <p>In the laboratory, we placed more devices and used multiple platforms to work with them. This time
SensorTag sent data about room temperature, humidity and light. Also, we used a sensor of opening/closing
doors and a web camera to record those entered/exited the room. As noted earlier, for obtaining data on
temperature, humidity and light, their processing and saving to file, we used two programming language –
Java and Jolie, which were running on the Raspberry Pi. Work with other sensors and a camera was assigned
to HomeOS, which has the necessary functionality for working with the devices. Based on all the collected
data, we constructed graphs of the temperature, humidity, and light conditions (Figure 4, 5, 6). Using a
sensor on the door and the camera data, we obtained data how many people were in the room in each
moment of time and assembled a small dataset of photo lab workers.</p>
      <p>This completes the main work of the first stage. Plans for further development of the project and
data will be described in the next section.</p>
    </sec>
    <sec id="sec-5">
      <title>FUTURE STEPS</title>
      <p>Despite having solved many of the problems with obtaining data from the sensors and further
processing, in order to get the targeted result there are many problems that need to be addressed. First, we
must configure all SensorTags to work on the ZigBee protocol because in the future we will set up these
sensors in a variety of classrooms at our university, and there is a need to build a mesh network for
communication between devices and further processing in the language Jolie.</p>
      <p>Second, we need to expand the functionality of the language Jolie to work with all our devices. In
this case, we must write the modules for BLE, ZigBee and Z-Wave devices to continue to connect easily and
share data between smart devices. In addition, we want to rewrite the module for working with the Aeon
Labs sensors in Jolie language.</p>
      <p>
        Thirdly, we need to place all sensors and the Raspberry Pi in the classroom of the University and in
the room of the student and start collecting data. In the room of the student, they will continue collecting
data on temperature including the data on humidity and lighting as well as installing a window-opening
sensor that will allow us to get good dataset to determine the preferred mode of temperature, light and
humidity in the room and drawing a small daily schedule of a student. In the classrooms, we will also install
a small camera to track the number of people in the room and launch a small bot to Telegram messenger to
gather feedback from students in terms of comfort temperature and humidity in the auditorium. In the lab,
we will add a motion sensor and several relays to control lights and power sockets in the room that will be
activated either automatically or manually through a central control system. One could even envision
integration of our system with outdoor area monitoring (for example, car park areas [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]), vegetation
monitoring and identification [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ], or with recommendation systems in order to create user-tailored
hospitality services in large buildings [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ], and with information based on periodic aerial monitoring [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ].
      </p>
      <p>Based on the obtained data, which will take about a month to collect, we will build a prediction
system for students and employees, which will be checked by a simple small bot in Telegram. Thus, we will
improve our result in order to begin to create a small artificial intelligence that is responsible for the control
of lighting, temperature, electricity and comfort level in the room.</p>
      <p>All this will lead to the creation of a unified platform, unified control center, written in Jolie that will
allow:
1. To develop a system of microservices and the language Jolie;
2. Easy to incorporate new devices operating according to one of three protocols;
3. To track the preferences of students and staff in the environment;
4. To control the flow of electricity to the premises and, if possible, to suggest ways to reduce costs;
5. To use predictive methods on the basis of long-term logged data;
6. To create examples of concurrent applications supporting Energy Management, Security &amp; Hospitality;
7. Develop the idea of Human-Building Interaction and technologies on campus and the entire city.</p>
    </sec>
    <sec id="sec-6">
      <title>CONCLUSION</title>
      <p>As the Internet of Things becomes more widespread, and given the current availability of sensors
and embedded processing units, the prospect for advanced smart buildings utilizing such technologies
becomes increasingly attractive. Furthermore, the possibility of creating architectures utilizing distributed
microservices and supporting various concurrent applications to be running on them (such as energy
management, security, and hospitality applications), is opening new avenues for flexibility, scalability and
reusability. Towards that goal, we created a platform based on a network of advanced SensorTags utilizing
Jolie: a new, simple yet flexible language, which supports microservices and the Internet of Things. Through
an initial implementation, we demonstrated the viability and power of our approach, and we are also
contributing towards creating an expanding set of tools in Jolie that will be shared and reused with our
wider community. We are currently working on enlarging our network and data collection, and on
integrating advanced visualizations and human-building interfaces, as well as prediction abilities and
usercentered customization. We hope that through the wider introduction of such systems, the buildings of the
coming decade will be much more interesting places to live and work, that will not only be efficient, but will
also help preserve our environment, and create sustainable prosperity for mankind, in harmony with
nature.</p>
      <p>References
Гусманов
Мавридис Николаос, руководитель лаборатории когнитивных робототехнических систем Университета Иннополис,
n.mavridis@innopolis.ru.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <article-title>Internet of Things Global Standards Init</article-title>
          . URL: http://www.itu.int/en/ITU-T/gsi/iot/Pages/default.aspx
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Renato</given-names>
            <surname>Jorge Caleira Nunes</surname>
          </string-name>
          ,
          <string-name>
            <surname>"Home Automation - A Step Towards Better Energy Management</surname>
          </string-name>
          "
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>M.</given-names>
            <surname>Mazzara</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Mustafin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Safina</surname>
          </string-name>
          .
          <article-title>"Towards Microservices and Beyond"</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <article-title>Internet of Things (IoT): number of connected devices worldwide from 2012 to 2020</article-title>
          . URL: https://www.statista.com/statistics/471264/iot-number
          <article-title>-of-connected-devices-worldwide/</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Lallanne</surname>
          </string-name>
          ,
          <string-name>
            <surname>Denis</surname>
          </string-name>
          , et al., “
          <article-title>Human-Building Interaction in the Smart Living Lab”</article-title>
          ,
          <source>Future of Human-Building Interaction workshop, 34rd ACM Conference on Human Factors in Computing Systems (CHI</source>
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Mavridis</surname>
          </string-name>
          , N. et al.
          <article-title>"Smart buildings and the human-machine cloud</article-title>
          .
          <source>" GCC Conference and Exhibition (GCCCE)</source>
          ,
          <source>2015 IEEE 8th. IEEE</source>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Mavridis</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          , et al.
          <article-title>"Clic: A framework for distributed, on-demand, human-machine cognitive systems</article-title>
          .
          <source>" arXiv preprint arXiv:1312.2242</source>
          (
          <year>2013</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8. Jolie:
          <article-title>The first language for micro-services</article-title>
          , http://www.jolie-lang.org
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Mavridis</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bourlai</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Ognibene</surname>
            ,
            <given-names>D. "</given-names>
          </string-name>
          <article-title>The human-robot cloud: Situated collective intelligence on demand</article-title>
          .
          <source>" Cyber Technology in Automation, Control, and Intelligent Systems (IEEE CYBER)</source>
          ,
          <year>2012</year>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>10. Microsoft Research: The Lab of Things. URL: http://www.lab-of-things.com/</mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11. JermsuraWong J.,
          <string-name>
            <surname>Ahsan</surname>
            ,
            <given-names>M.U.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Haidar</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dong H</surname>
          </string-name>
          .
          <article-title>and</article-title>
          <string-name>
            <surname>Mavridis</surname>
          </string-name>
          , N. “
          <article-title>Car parking vacancy detection and its application in 24-hour statistical analysis</article-title>
          ,
          <source>” in Proc. of 10th Intern. Conference on Frontiers of Information Technology (FIT</source>
          <year>2012</year>
          ),
          <year>December 2012</year>
          , pp.
          <fpage>84</fpage>
          -
          <lpage>90</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Haidar</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dong</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          <article-title>and</article-title>
          <string-name>
            <surname>Mavridis</surname>
          </string-name>
          , N. “
          <article-title>Image-based date fruit classification,”</article-title>
          <source>in Proc. of Intern. Congress on Ultra Modern Telecommunications and Control Systems (ICUMT</source>
          <year>2012</year>
          ),
          <year>October 2012</year>
          , pp.
          <fpage>369</fpage>
          -
          <lpage>375</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>AlFalahi</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mavridis</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Atif</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          “
          <article-title>Social networks and recommender systems: A world of current and future synergies,” In A. Abraham and A</article-title>
          .
          <string-name>
            <surname>Hassanien</surname>
          </string-name>
          (Eds.).
          <source>Computational Social Networks: Tools, Perspectives and Applications</source>
          , Springer Verlag,
          <year>2012</year>
          , pp.
          <fpage>445</fpage>
          -
          <lpage>465</lpage>
          , DOI 10.1007/978-1-
          <fpage>4471</fpage>
          -4048-1 18
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Giakoumidis</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bak</surname>
            <given-names>J.U.</given-names>
          </string-name>
          , Gó mez
          <string-name>
            <given-names>J.V.</given-names>
            ,
            <surname>Llenga</surname>
          </string-name>
          <string-name>
            <given-names>A.</given-names>
            and
            <surname>Mavridis</surname>
          </string-name>
          , N. “
          <article-title>Pilot-scale development of a UAV-UGV hybrid with air-based UGV path planning</article-title>
          ,”
          <source>in Proceedings of 10th International Conference on Frontiers of Information Technology (FIT</source>
          <year>2012</year>
          ),
          <year>December 2012</year>
          , pp.
          <fpage>204</fpage>
          -
          <lpage>208</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>