SlideShare a Scribd company logo
1 of 61
Download to read offline
0
Tamagreen: A Green Tamagotchi
Akhil Ravindran
A thesis submitted in part fulfillment of the
degree of MSc. Computer Science by Negotiated Learning
with the supervision of Assos. Professor Eleni Mangina
School of Computer Science
University College Dublin
August 2016
1
ACKNOWLEDGEMENTS
I would like to thank the firm Wattics for providing me with the hardware device
which is an integral part of my application. Wattics team has helped me in setting
up my application and also guided me with the initial requirements. Antonio,
CEO of Wattics has guided me throughout the application development and also
let me work in the Wattics office. Alex and Michele, the lead developers at
Wattics were the first point of contact for me for any technical issues
I would also like to thank my supervisor Eleni, for her continuous guidance that
has helped me to complete my application and thesis.
Last but not the least I would like to thank all my friends and family for their
support.
2
DECLARATION
“I hereby certify that this dissertation is entirely my own work. Neither the work
nor parts thereof have been published elsewhere in either paper or electronic
form unless indicated otherwise through referencing”.
Signed: ___________________________________
Date: _______15-08-2016 ______________
Akhil Ravindran
3
MOTIVATION
The following thesis is basically about making young kids aware about energy
consumption and the effects it has on the environment. Energy conservation is
unquestionably of great importance to everyone since we rely on energy for
everything we do in our daily lives. Energy supplies are exhaustive and to
maintain a good quality of life we need to use energy wisely.
It is very important to inculcate the concept of energy awareness in young
scholars. They are our future and making them realise the importance of
conserving energy and using it only if required will be an important step in the
ultimate goal of reducing worldwide energy consumption in the future.
A popular way of making people use less energy is by bringing about a change in
their energy consumption behaviour. Young minds are vulnerable and easy to
mould, hence embedding the importance of energy consumption in these minds
will help make a big difference in their future actions as adults. The application
proposes a visual and fun way for kids by making use of kid-friendly images or
gifs to encourage children towards becoming energy aware and consumes less
energy whenever and wherever possible. The application will always provide
real-time feedback to get the attention from these young minds by bringing
about changes in the images displayed by reading their energy behaviour.
Lastly, the application has the scope of implementing various new technologies
and features which can make it develop further and be used in corporate
organisations and also household apartments. Intelligent energy use is the need
for the day. Many efforts are being taken to conserve energy and use existing
energy wisely on a global scale.
4
CONTENTS
1 Introduction………………………………………………………………………………………...5
2 Literature Review…………………………………………………………………………………6
3 Analysis and Design……………………………………………………………………………18
4 Implementation………………………………………………………………………………….37
5 Evaluation………………………………………………………………………………………….53
6 Future Work………………………………………………………………………………………58
7 Conclusion…………………………………………………………………………………………59
8 References…………………………………………………………………………………………60
5
Chapter 1: Introduction
Energy awareness is the need for the day currently. Making young scholars
aware about energy conservation at a young age is very important and difficult
at the same time. We are introducing a Tamagreen project which will help make
young scholars pay more attention to be aware of the amount of energy
consumed by them and thus make them know the importance of energy
consumption.
The application will be displaying some pre-defined images to the young kids as
per the energy consumption of their school. With reduced energy consumption
will display some positive images whereas increased energy consumption will
display negative images. The response of the application will be real time as per
the current energy consumption at the school. This will encourage the students
to use the energy efficiently.
The application aims to provide a user-friendly interface to the school staff
where they will be able to configure the application with images that will be
intriguing to the young kids. The user will be able to log in and set any kind of
image for the application corresponding to the energy consumption criteria.
Wattics is an energy analytics firm which will be providing a smart meter to be
installed in the school using which energy consumption data will be collected.
The application will implement a Java API to retrieve data from Wattics database.
The application will also take the outside temperature into consideration while
predicting the energy consumption data.
The following thesis will be describing the functionality and the implementation
of the application further.
6
Chapter 2: Literature Review
2.1 Introduction
Conserving energy is the best way to ensure sustainable energy and reduce
greenhouse gases. Energy conservation is a major issue currently and has been
addressed in many EU programmes. Energy can be saved through increased
energy efficiency or reduced energy consumption.
In today’s world, energy consumption is a matter of utmost importance. The
amount of energy required is exponentially increasing. Saving energy is a
challenge globally faced due to the increase in energy demand. The only way to
tackle the problem is to consume energy efficiently or use only what is required
thus conserving it. Energy conservation differs from efficient energy use, which
refers to using less energy for a constant service. Even though energy
conservation reduces energy services, it can result in increased environmental
quality, national security and personal financial security. It is at the top of the
sustainable energy hierarchy. It also lowers energy costs by preventing
future resource depletion.
One way to achieve this is having rules and regulations imposed by the
government. The other way can be by research. Finding out new ways to
conserve or use less energy with the help of technology. This can be achieved
only through research of current and existing energy consumption methods and
consumer attitude towards energy conservation.
7
2.2 Review of Literature
The European Union has its own agenda for energy conservation. The
Conclusions of the European Council of 8–9 March 2007 emphasised the need for
the European Union (EU) to achieve the objective of saving 20 % of primary
energy consumption by 2020, compared to projections. The European Council of
4 February 2011 emphasised that the 2020 target must be delivered, but also
recognised that the Member States are not on track to fulfil this commitment. On
reaction to this on October 2012, the European Union adopted the Energy
Efficiency Directive to achieve a reduction by 20% in energy consumption by
2020. The implementation of this directive and other policies that have been
adopted in recent years will require a change in consumer behaviour and energy
consumption practices.
On analysis of recent available literature, it is found that consumer behaviour is
mostly affected by combining direct and indirect feedback from energy suppliers.
Direct feedback involves information received from computer or smart
electronic meters whereas indirect feedback involves electricity bills.
An EEA technical report – “Achieving energy efficiency through
behaviour change” says that the major factor affecting consumer behaviour are
energy feedback, energy audits and community-based initiatives. The research
suggests that only technical implementation will not be successful to achieve
reduced energy consumption. The technical implementations are more
expensive to achieve in isolation. It needs to be combined with a behaviour
change programme which can achieve energy consumption awareness in
consumers more effectively. Consumption behaviour of an individual basically
depends on the needs, opportunities, belief system and abilities. Behaviour
change programmes can be different in domestic and non-domestic
environments since households have a direct connection between their energy
consumption behaviour and monthly costs whereas the effect of behavioural
changes in the non-domestic environment is affected at the organisational level
and an individual employee is not affected directly by it. The motivation for
employees to engage in energy efficiency behaviours is therefore very different
and must rely on corporate and social responsibility objectives and reinforce
societal norms. Goal or target setting is another way to indulge households in
energy saving. Households can decide for themselves and commit to a target to
achieve.
Research (Becker, 1978) found that not only did the level of the target have an
influence on how well people perform in energy saving, but that an energy-
saving target combined with feedback resulted in higher savings. This indicates
that feedback can help households determine how close they are to achieving
their goal. Becker's research looked at the electricity use of 80 families in the
United States who were asked to set either an easy (2 %) or a difficult (20 %)
8
energy-saving goal. The sample was further divided into those who received
feedback three times a week and those who did not receive feedback. A control
group of additional 20 families received neither a goal nor feedback
Energy audits have been instrumental in advancing energy efficiency in Europe
for many years. More specifically, Article 8 of the Energy Efficiency Directive
includes recommendations for Member States to promote energy audit activities
in the small and medium-sized enterprise (SME) sector and makes energy audits
mandatory for large enterprises. In addition, the directive encourages the
Member States to raise awareness about the benefits of energy audits among
households.
2.2.1 Use Case: the Norwegian Industrial Energy Efficiency Network (IEEN)
The IEEN was established in 1989 by the Ministry of Petroleum and Energy in
Norway to stimulate energy efficiency measures. The programme was
instrumental in identifying and realising the industrial energy efficiency
potential in the mid-1990s. A total of 900 companies (two-thirds being SMEs)
participated in the programme. At that time, the Norwegian government set up
an energy-saving target of 43 PJ/year to be achieved by 2010, out of which 9 PJ/y
were expected to be delivered by the industry through energy efficiency
measures and switching to renewable energy.
Community-based initiatives by undertaking energy awareness programmes are
a new way of bringing about pro-environmental behaviour change.
Within the framework of such initiatives, small groups of people gather together
and decide on a range of behaviours and attitudes that can be changed either to
reduce their overall environmental footprint and/or to increase energy
efficiency, in a report group format. The group size varies: from less than 10
people to more than 100, but in some cases reaching 1000 individuals. The group
meets regularly and is given access to reliable information through written
material and/or access to a trained expert. The group studies the information
available and decides on the range of behaviours to be changed for the purpose
of reducing their overall environmental impact and/or reducing energy
consumption.
2.2.2 Dynamic Pricing
Pricing is one of the factors that can be used to change consumer behaviour in
energy consumption. Dynamic pricing refers to change in the cost of energy as
per demand or the time when the energy is used. For eg., if there is high demand
the pricing will be higher thus making the consumer to use less. Similarly, in any
particular time of the day, the price may vary. Dynamic pricing can also be
imposed on the amount of consumption of energy i.e. if the consumption is
greater than a certain limit the price will be higher. Smart meters have enabled
to introduced dynamic pricing in energy costs.
9
2.3 Use Case Of Smart Meters
2.3.1 The NRGi smart meter roll-out programme
Between 2009 and 2012, NRGi, a Danish energy company, installed 210 000
smart meters throughout their customer base. The primary objective of the
programme was to prepare their service network for the future with better
opportunities to spread the load and cheaper ways to maintain the grid.
Changing consumer behaviour or achieving energy savings were not factored
specifically into the programme. In fact, according to a company representative,
one of the bigger challenges they encountered during the roll-out was explaining
to their customers why there is a need for a new meter and why new features are
being added. Customers have the option to view their energy consumption via
smartphone or the Web, but the company did not observe much interest on the
part of the consumers in these feedback options.
2.3.2 The Swedish experience with smart meters
The energy market in Sweden was opened in 1996. The smart meter roll-out
programme started back in 2006 and was finalised in 2009 when mandatory
monthly meter reading was introduced for all 5.2 million customers throughout
the country. As of October 2012, all customers can have hourly readings if they
wish, but this granularity is mandatory for customers in tertiary and industrial
sectors. In May 2012, the Swedish government appointed the Coordination
Council for Smart Grid, whose role is to 'coordinate and stimulate cooperation
and knowledge transfer between different actors in the area of smart grid and
deliver proposals to accelerate the development of smart grid in Sweden'.
Various studies have shown that a purely technological approach to reduce
energy consumption often leads to disappointing results due to changes in user
behaviour, which have been described as rebound effects. The rebound effect or
take-back effect is the term used to describe the impact lower costs of energy
services (due to increased energy efficiency) have on consumer behaviour, both
individually and nationally. Put simply, the 'rebound' effect is the extent to which
the energy saving generated through energy efficiency measures is taken back by
consumers in the form of higher consumption, either by increasing the quantity
of energy used (for instance to increase their comfort levels) or due to a higher
quality of energy service.
Also, resistance to new systems and negative experiences, for example, due to
faulty automation or lacking user friendliness, has frustrated the high hopes of
innovative technologies. On the other hand, the effects of purely behavioural
approaches have been very successful neither or mixed at best (e.g. Weenig &
Midden, 1997). One of the main reasons for the lack of success is that most
communication programs targeted the intentions of users, but largely ignored
the technical context in which consumption choices actually occur. Basically, we
view energy efficiency and conservation as the outcomes of multiple interactions
10
between technological systems and human users. It follows that interventions
that aim to influence consumption behaviour should be concentrating on guiding
interactions between users and systems.
One of the quality issues encountered during the review was related to the fact
that the analysis of behaviour change measures was based on limited attitudinal
surveys; the projects did not always measure the impact on energy consumption.
Some reports did identify measured reductions in energy use, while others
investigated only the shift between peak and off-peak demand.
Prior to the 1990’s, experiments using electronic devices indicated that they
might contribute to the efficiency and effectiveness of behavioural interventions,
but the technology just wasn’t yet smart enough in most cases to make these
devices very successful. Technology has been so advanced now that we can make
use of them to change the behaviour pattern of the consumer by providing user-
friendly applications for energy awareness and conserving energy. Nowadays
applications are created with a gamification theme to get the attention of the
consumer and impact a change.
2.3.3 Energy Saving Becomes A Game
Energy Life is a system utilising wireless sensors and a smartphone that turns
energy consumers into active players. Energy Life participants play through
different levels collecting scores in savings and through advice tip reading and
quizzes. Key principles embodied in Energy Life are: situated and combined
feedback including knowledge and consumption information, intuitiveness and
non-intrusiveness by utilising an always at hand solution on a touch enabled
smartphone, sustained interaction, and engagement by using an applied game
that connects players within and between households.
Householders do not always know how much energy they consume. To help
improve their awareness, the EnergyLife app was developed through BeAware,
an EU funded project, led by the Helsinki Institute for Information
Technology (HIIT), in Finland. As part of the project, consumers in test groups
had their home appliances fitted with wireless sensors. This enabled real-time
information on power consumption to be delivered via the mobile app. What
makes this app unique? It is designed like a game to entice the consumer to treat
energy saving as a fun activity. By reading tips, completing quizzes and reducing
their electricity usage they were able to collect scores and progress through
higher levels in the game.
“What we noticed with all lot of energy awareness programmes is that they have
an impact for a limited time, but people lose interest over time,” explains Giulio
Jacucci, the project coordinator and a professor of computer science at HIIT. “The
idea of gamification is to maintain engagement by accompanying the consumer
through a process whereby they learn something, achieve some goals and move
on to the next level. If they are under-challenged, they will become bored
11
whereas if they are over-challenged, they become frustrated.” He believes the
game provides a way of always keeping consumers engaged with the right
amount of challenge.
This approach leads to collaboration among players. “The gamification process
introduces some interesting social mechanisms,” he adds, “The users compete
for one against another initially. But after a while, they start to ask questions of
each other, so it becomes cooperative in the way they share new information and
knowledge.” Jacucci says that he intuitively believes the gaming aspects enhance
the effectiveness of the app. However, because the study did not include a
control group receiving the same advice through more conventional means, he
acknowledges results are inconclusive.
What the results nevertheless showed that when users were provided with
personalised feedback, they achieved the greatest savings. This, Jacucci believes,
is because it crystallised the link between specific behaviour – for example
putting something very hot in the refrigerator – and experiencing a temporary
setback in meeting goals, as part of the game. “Personalising the advice can really
make a difference,” agrees Niamh McDonald, a buildings policy analyst at
the Global Buildings Performance Network in Paris, France. She tells youris.com:
“Not everyone is the same, and different households will have different needs,
values and interests.”
She also argues that because the user experience is designed to be
positive, programmes like EnergyLife offer greater chances of success than
campaigns setting out to make consumers feel guilty about damaging the
environment. “If people take the time to get involved in a voluntary programme,
it makes no sense to criticise them,” she says. “Rather than preaching,
empowering them to make changes is definitely the way to go.”
Many behavioural change programmes fail because it takes the time to achieve
real results, according to Alec Dorling, manager of embedded software process
organisation with the Volvo Group in Sweden. Referring to his own research on
the role of gamification in software process improvement, he tells youris.com:
“In game playing, the psychology is to provide a lot of points early on, enabling
achievement of levels 1-2 very quickly. This provides fast feedback and creates
engagement and motivation.” The key to making energy saving “fun”, Dorling
believes, centres on carefully maintaining the balance between abilities and
challenge.
2.3.4 EkoGuru – Social App For Energy Awareness
Refresh is excited to be involved with EkoGuru.com which is the brainchild
of gamification guru Wynand Goosen who has studied gamification design in San
Francisco which lead to the development of the EkoGuru web app. EkoGuru aims
to make saving energy a fun and easy habit, with the use of a social game aiming
to change energy habits and reduce the reliance on dirty power.
12
Ekoguru makes being energy aware fun and easy. Rewarding energy efficiency
while suggesting simple ways to decrease the consumption and your bills.
Ekoguru has been designed to make what is normally a boring, slow process of
trying to change energy use habits into a fun, social and engaging activity for the
whole family. Gamification and Hook principles have been introduced in the app
to ensure players remain engaged. Ekoguru audit player’s appliance data and
recommend energy efficient alternatives to purchasing. Players compete and
interact within their neighbourhoods, cities, states and nations. Players challenge
each other through fun energy saving tasks and dares. Ekoguru is designed to
generate big data related to energy use on a global scale, lead generation for
solar installers, financial institutions providing credit for energy-related retail
purchases and appliance manufacturers and distributors. Ekoguru is launching
on Earth Hour day with further phases rolling out in April and May to include
more aspects of sustainable living.
Technology Profile Ekoguru
 Wordpress CMS
 Google Analytics
 CSS (Cascading Style Sheets)
 HTML (HyperText Markup Language)
 Html5
 Javascript
 jQuery
 jQueryUI
 Php (Hypertext Preprocessor)
2.3.5 Green Shifting A mobile application for the efficient usage of
renewable energy
A mobile application is designed and implemented to inform an energy
consumer about times with a high amount of renewable energy produced, so he
or she shifts the usage of energy consumers to those times and thus use rather
renewable energy than conventional. The application is implemented using a
cross-platform development tool. To motivate users to actively use it,
gamification elements are included. Its usability is evaluated with five test users.
The result is Green Shifting, a cross-platform mobile application that encourages
users to use the available renewable energy more efficiently.
This is a system that supports users who are interested in improving their own
renewable energy awareness. Everyone can easily shift the usage of some
electronic devices like washing machines to time slots when there is a lot of
renewable energy produced. They only need to know when these times are.
Therefore, data about the produced energy needs to be requested from the
providers and published in a way that as many people as possible can access and
use it. It is the concept of the Green Shifting system to fulfill exactly these
13
requirements by collecting the energy data, processing it and presenting it to the
end user. The publication is achieved via a mobile application that visualises the
energy information. To reach as many users as possible this application needs to
be available for the most common mobile platforms
Figure 4.1 shows the different components of the system. The energy data is
collected and processed by a server and then stored on a Firebase database. The
application enables the interaction of the mobile devices with the database. To
send push notifications, the server invokes an event on the system specific
messaging servers which send the notification to the registered device. Table 4.1
shows the association of platforms and messaging servers.
The database management system used in the Green Shifting system is Firebase.
It is a powerful API to store and sync the data in real-time. Its libraries run on all
major web and mobile platforms and can be extended using the REST API.
Figure 2.1
2.3.6 Energy Awareness Programme for Schools – Programmes for children
and teachers
Tipperary Energy Agency has teamed up with the Sustainable Energy Authority of
Ireland (SEAI) to deliver energy workshops to primary and secondary schools in Co
Tipperary.
The programmes, which are free of charge to the schools, provide a series of interactive,
hands-on workshops for students. In primary schools, the programme is delivered from
senior infants right up to sixth class and teaches children the science of energy and
energy efficiency. At secondary school level, 1st and 2nd-year science students are
14
taught about the science of energy, using everyday materials based on simple scientific
principles.
Last year the programme visited 32 schools and met over 1400 children. SEAI
are now also offering “Exploring Our Energy”, which is a whole school
programme aimed at teachers in the primary school environment. As well as a
range of supports for teachers to use the programme in class, an after-hours CPD
workshop is also available to teachers.
15
2.4 Summary
Project Title Summary Year Comments Pros & Cons
Norwegian
Industrial Energy
Efficiency Network
The programme was instrumental
in identifying and implementing
energy efficiency techniques and
potential for energy efficiency in
small and medium sized industries
1989 The Norway government set a
target to be achieved by the
industries through energy
efficiency schemes which
encourage the industries to
implement such schemes
Many Small and medium scale
enterprises were encouraged to
switch to renewable energy
sources to meet the energy-
saving target
The NRGi smart
meter roll-out
programme
Installing smart meters throughout
the customer base with an objective
to prepare their service network for
future challenges
2009-
2012
With the smart meters the
customers were able to view their
energy consumption in mobile
phones which acted as a feedback
and in turn affected their energy
consumption behaviour.
Customers had an option for
feedback from these smart
meters via smartphone or the
web.
Customers were not much
interested in these feedback
options and it was difficult
explaining to the customers why
there is a need for new meters.
Smart Meters in
Sweden
Smart meters were rolled out to the
customer base and mandatory
monthly reading was introduced.
2006 Customers can have hourly reading
with these meters now which is
good for a quick feedback option
on the energy consumption
A mandatory monthly meter
reading encouraged the
customers to review their energy
consumption every month. The
customers could also have hourly
readings if they wish.
Resistance to the new system and
negative experiences like faulty
automation, lacking user
friendliness, etc.
16
Energy Life Energy Life is a system utilizing
wireless sensors and a smartphone
that turns energy consumers into
active players. Energy Life
participants play through different
levels collecting scores in savings
and through advice tip reading and
quizzes
2012 Real-time energy consumption
information was delivered to the
mobile app in this project which
helped the consumer to monitor
their energy consumption
behaviour in real time.
Real-time energy consumption
information was delivered to the
users via a mobile app. It was
developed as a game to entice
users to treat it as a fun activity.
Users achieved greater savings.
EkoGuru – Social
App For Energy
Awareness
Ekoguru audit player’s appliance
data and recommend energy
efficient alternatives to purchasing.
Players compete and interact
within their neighbourhoods, cities,
states and nations. Players
challenge each other through fun
energy saving tasks and dares.
2015 Ekoguru makes awareness about
energy consumption fun and
encourages people to use less
energy by innovative and effective
ways of competing with others,
dares, socialising, etc.
EkoGuru suggests simple ways to
reduce energy consumption.
Gamification elements make the
application fun to use.
EkoGuru is a web application and
hence requires an active internet
connection to use it.
Green Shifting A
mobile application
for the efficient
usage of renewable
energy
A mobile application is designed
and implemented to inform an
energy consumer about times with
a high amount of renewable energy
produced, so he or she shifts the
usage of energy consumers to those
times and thus use rather
renewable energy than
conventional.
2015 The unique concept of informing
the user the times when renewable
energy resources are used will help
consumers save a lot of energy by a
much little reduction in energy
consumption. It will have a larger
impact with minute changes in
user behaviour towards energy
consumption.
The application collects energy
production information from the
providers and presents it in a
very user-friendly way. The data
is sync real-time.
17
2.5 Conclusion
Energy conservation can be effectively achieved only by combining the use of
technology with consumer behaviour. Achieving a positive change in consumer
behaviour with regards to energy use is a vital step towards energy conservation. Using
technology applications with innovative and creative approaches will indulge the
customers in using it and thus spread energy awareness is one way of achieving the
technology behaviour combination.
Tamagreen is an innovative web application to teach young scholars energy awareness
and the impact that energy consumption has in the society where we live in. Inculcating
an idea of saving energy in young minds is the best way to reduce energy use in the
future.
18
Chapter 3: Analysis and Design
This chapter explains the underlying Tamagreen System and the API developed
for data extraction. A conceptual framework is described in the analysis section.
The design section explains the general structure of the solution design that will
be used to implement the analysis. Design section will also explain individual
pages of the whole system in detail, the parameters of the entities that will exist
in the system and also the API developed to extract data. Technologies Section
will explain the infrastructural elements of the proposed system along with the
development environment and the database.
3.1 System Overview
Figure 3.1
The application is basically divided into three parts –
 Rails Application
 Java API
 Wattics
Rails Application
This is a web application developed using Ruby on Rails. It basically comprises of
the front-end of the application which the user interacts with.
19
Java API
The Java API is a middleware for the web application to interact with the Wattics
System. It uses RESTful API to achieve this.
Wattics System
Wattics provides smart meters which will be installed in the organization to get
energy consumption data. This data is then retrieved using a JDBC connection to
the Wattics database.
3.2 Analysis
3.2.1 Tamagreen Web Application
The project includes developing an interactive Ruby on Rails web app to be
displayed on a large screen at the entrance of the school that learns the
consumption patterns of the school and the good or bad behavior of teachers and
children. It will then display an entertaining and animated character that
responds to the energy-efficient or wasteful behavior of individuals in the school.
The app will develop Java functions to retrieve energy and expected energy data
from an existing Wattics online energy analytics database (MySQL). It will then
animate Tamagreen if the energy consumption goes below or above the expected
energy at that time of the day.
After the initial analysis of the application was complete , 6 core pages were
identified that are essential for a system with only core functionalities.
 Authentication Pages:
1. Login
2. Register
 User Pages:
1. Welcome Page
2. Application Configuration
3. Edit User Info
4. Logging
 Super User Page:
1. Admin Profile
 Tamagreen display page
3.2.2 Tamagreen API
A Java API will be developed to access the information from Wattics database.
The API will give the expected energy consumption data based on the current
temperature and the previous energy consumption. It will also get data about the
current energy consumption to compare with the expected energy consumption
and calculate the offset.
The API will be used to implement following services:
20
 Add user to database.
 Update user in the database.
 Get current electricity consumption
 Get expected electricity consumption
3.3 Design
3.3.1 Tamagreen Web Application
User Pages
Welcome page will contain an introduction to the Tamagreen application with
an image representing Green energy. Access to Login and Register pages will be
through the links in this page.
Login page will control the user authentication and it will ask for a username
and password from the user. Access to Application configuration and Admin
Profile page will be through the login page. There will be predefined users with
super-user/ admin access. If login username is one of the superuser usernames
then the page is redirected to Admin Profile Page. If a general user is logged in,
he/she will be redirected to application configuration page.
Register page will be used by new users of Tamagreen Web App. It will ask the
prospective user for their username, password, meterid. Once the user registers,
he/she will have to wait for the admin to review his details and approve him.
Application Configuration page will enable the user to upload the images to be
displayed based on the electricity consumption offset. The user will be asked to
enter the nature of offset i.e. positive or negative. Positive offset means the
current energy consumption is less than the previous energy consumption.
Negative offset is when the current energy consumption is greater than the
previous energy consumption. The user will also be asked to enter the offset
value in percentage and select the image corresponding to this combination and
click on save.
A mock up for the above flow:
Figure 3.2
The entry will be :
Positive/Negative Offset > {Value}% and the corresponding image.
The user can enter multiple combinations and set images for each combination.
The image corresponding to the calculated combination will be used to trigger
the application.
21
The Edit user info page and the Tamagreen application main page is accessed
from this page.
Edit User Info page will display the username and channel id for logged in user.
The username is not editable. The user can edit password or channel id and click
on save. After submitting the user will be able to log in only after the super user
approves the new changes again.
Tamagreen main page calculates the offset percentage from the expected value
and current value of energy consumption and retrieves the corresponding image
stored in SQLLite database at the client side. The page reloads every 5 seconds
using an AJAX call.
Logging is used to view the data of actual and expected energy consumption in
numbers along with the offset percentage. This data can be used as a guide to set
the images in the configuration page.
Admin Page
Admin Profile page displays the list of users that are currently registered to the
Tamagreen Web Application with their current status on the application. The
admin can approve new users registered or when changes are made to existing
users.
The Web Application framework is portrayed in the UML diagram – Figure 3.3
3.3.2 Tamagreen API
In computer programming, an application programming interface (API) is a set
of routines, protocols, and tools for building software and applications. An API
expresses a software component in terms of its operations, inputs, outputs, and
underlying types, defining functionalities that are independent of their
respective implementations, which allows definitions and implementations to
vary without compromising the interface. A good API makes it easier to develop
a program by providing all the building blocks, which are then put together by
the programmer. An API may be for a web-based system, operating system, or
database system, and it provides facilities to develop applications for that system
using a given programming language.
TamagreenServiceAddUser
This service will call the underlying addUser Java method to add the username
and password to the MySQL database at the server side. The requested URL will
contain the username and password. The password will be hashed using MD5.
The user will be added to User table and User_roles table with role member. The
addUser service can only be called using admin authentication i.e. a user with
role admin. Admin users are predefined in the database at the server side with
the same credentials as that used in the web application. The add user is called
22
when the Admin approves the newly registered user from the admin profile UI.
The response XML contains the username and the hashed password.
TamagreenServiceUpdateUser
This service will call the underlying updateUser Java method of the API to update
the password of the user corresponding to the username received in the MySQL
database. The requested URL will contain the username and password. The
password will be hashed using MD5. The password will be updated in the User
table. The updateUser service can only be called using admin authentication i.e.
user with role admin. Admin users are predefined in the database at the server
side with the same credentials as that used in the web application. The updated
user is called when the Admin approves the changes made to an existing user
from the admin profile UI. The response XML contains the username and hashed
password.
TamagreenServicerawdata
This service calls the underlying Java method of the API to get the current
electricity consumption data from the Wattics database. When the user runs the
Tamagreen main page, the service is invoked. The requested URL for the service
contains the channel id and the timestamp. The method invoked by the service
establishes a JDBC connection with Wattics database and queries the
electricity_raw table with the channel id and the timestamp. The data
corresponding to the timestamp that is nearest to the input timestamp is
retrieved. Active power for each phase i.e. active_power_A, active_power_B,
active_power_C is retrieved and their sum is stored in totalactivepower. These
values are then sent back in the response XML. This service is invoked when the
Tamagreen web application main page loads each time. The access to this service
is for users with role member. Hence the service is invoked only when the user
with role member is logged in. Basic HTTP Authentication is used.
TamagreenServiceexpectedconsumtpion
This service calls the underlying Java method of the API to get the expected
energy consumption data calculated using the previous energy consumption
data from Wattics database taking into account the temperature of the day using
Simple Regression Model. The requested URL contains the channel id and
timestamp. The energy consumption data for 7 days prior to the timestamp for
each hour between 8 am to 4 pm is extracted from Wattics database. The
temperature corresponding to this data is also extracted using
WeatherUnderground API. The WeatherUnderground API gives the historical
temperature for each hour of the day for the last 7 days from the timestamp
between hours 8 am to 4 pm.
Using the data for electricity consumption and the corresponding temperature a
regression model is developed and the slope and intercept are calculated. Using
the org apache math3 package which provides a Simple Regression class named -
23
org.apache.commons.math3.stat.regression.SimpleRegression, the regression
model can be calculated. The current temperature corresponding to the
timestamp in the request URL is extracted using WeatherUnderground API.
Using the temperature and the slope and intercept from the regression model,
the expected electricity consumption is calculated using slope-intercept formula.
The expected electricity consumption is then sent in the response message.
The Java API framework is described in the UML diagram – Figure 3.4
24
3.4 UML Diagram
3.4.1 Ruby Web App
Figure 3.3
25
3.4.2 Java API
Figure 3.4
26
3.5 Use Case Diagram
3.5.1 Use Case for Student
Figure 3.5
ID Use Case 1
Title Student viewing Tamagreen Website
Description
A student views the Tamagreen page that runs on the
application
Primary
Actor
Student
Preconditions Tamagreen Page is displayed
Postcondition The page refreshes by itself
Success
Scenario
The displayed page reacts to the change in energy
consumption
27
3.5.2 Use Case for School Staff
Figure 3.6
ID Use Case 1
Title Configuring Application
Description
School Staff configures images to be displayed in the
application
Primary
Actor
School Staff
Preconditions Logged in as a member
Postcondition The images are uploaded to the application
Success
Scenario
The page is displayed with the correct image
ID Use Case 2
Title Login
Description School Staff login to the application
Primary
Actor
School Staff
Preconditions Valid username and password
Success
Scenario
User Logged in
ID Use Case 3
Title Register
Description School Staff registers as a member
Primary
Actor
School Staff
28
Preconditions
User must enter all the required details with unique
username
Success
Scenario
User is registered
ID Use Case 4
Title Edit User Preference
Description User can edit the account details
Primary
Actor
School Staff
Preconditions Logged in as School Staff
Success
Scenario
The details are updated
ID Use Case 5
Title Logging
Description User can view the logs in the application
Primary
Actor
School Staff
Preconditions Logged in as School Staff
Success
Scenario
The logs are displayed correctly
ID Use Case 6
Title Logging
Description User can view the logs in the application
Primary
Actor
School Staff
Preconditions Logged in as School Staff
Success
Scenario
The logs are displayed correctly
ID Use Case 7
Title Run application
Description
User runs the tamagreen application to display the
images
Primary Actor School Staff
Preconditions Logged in as School Staff
Success
Scenario
Images are displayed as per the energy consumption
29
3.5.3 Use Case Super Admin
Figure 3.7
ID Use Case 1
Title Login
Description Super admin logs into the application
Primary
Actor
Super User
Preconditions Valid username and password
Success
Scenario
User logged in successfully
ID Use Case 2
Title Approve new user
Description Super admin approves newly registered users
Primary
Actor
Super User
Preconditions Logged in as Super User
Success
Scenario
Users are approved and can access the application
30
3.6 Wattics High-Performance Power and Energy Meter
Wattics Energy analytics is a comprehensive, web-based, energy management
software platform that provides real-time energy data, projections of savings,
IPMVP measurement and verification, tariff analysis, energy performance
assessment, reporting and much more. The platform is the perfect tool for energy
managers and business owners making intelligent business decisions to identify
energy wastage, save money, increase sustainability and reduce carbon footprint.
Wattics allows a full flexibility for customers to collect data from the building,
and process directly from smart meters, sensors and other databases such as
process control systems and building automation systems. The hosted service
allows users to easily access real-time data on-line from any web-enabled
computer.
Wattics provided quality engineered energy Acuvim submeters provides a
simple robust solution for power monitoring, power quality analysis, kWh
metering, system integration, controlling power distribution systems & other
specialty applications.
Figure 3.8
Specification:
Input Range 10A-200A
Typical Input 100A, 200A
Rated Option 333mV
Window Size (in) 0.75 x 0.75
Window Size (mm) 19.1 x 19.1
Exterior Dimensions (in) 2 x 2.098 x 0.669
Exterior Dimensions (mm) 50.8 x 53.3 x 17
31
Some of the features of the meter include:
 NEMA 3 industrial grade weather-resistant enclosure protecting it against
rain, snow & dust while displaying a large three-line backlit LCD screen.
 Optional field-swappable communications modules for BACnet, Modbus,
DNP 3.0, Profibus and other protocols plus analog/digital I/O, alarms, &
relays.
 Optional DIN rail mount transducer form factor for system integration.
The Acuvim II series offers these powerful metering options.
 Data Logging
Maintains a historical record of data for users to remotely monitor trends,
analysis and reports with the capability to set threshold alarms in such
applications as tenant and facility metering.
 Time-Of-Use
Segment your peak hour kilowatt hour (kWh) usage for industrial,
commercial & tenant facilities by setting a time-based or tier-based rate
structure.
 Power Quality Monitoring
Safeguard against system failures with harmonic analysis and advanced
power quality event logging with waveform capture.
The Tamagreen application makes use of the data logging feature of the Acuvim
series meter. The data retrieved using the meter is stored in Wattics database
from where the application access required data to run the application.
3.7 Technologies
The following frameworks and libraries are a set of components that are widely
used for Web applications. As it is not a rare subset of technologies and there are
many people that are fluent in this kind of applications, it would be easier to find
developers for improvements they might need on the system. The majority of the
versions chosen are the latest versions of the given technologies and they are
well-built suite for providing any required functionality.
3.7.1 Ruby on Rails
Ruby is a dynamic, reflective, object-oriented, general-purpose programming
language. It was designed and developed in the mid-1990s by Yukihiro
Matsumoto in Japan. Ruby is thoroughly object-oriented with inheritance, mixins
Accuracy 0.50%
Standard/Certifications UR, CE, RoHS
Weight 0.2 lbs
Form Factor Square Split Core CT
32
and metaclasses. Ruby 2.0.0 is used in this project but it is upgradable to the
latest version.
Ruby on Rails, or simply Rails, is a web application framework written in Ruby
under MIT License. Rails is a model–view–controller (MVC) framework,
providing default structures for a database, a web service, and web pages. It
encourages and facilitates the use of web standards such as JSON or XML for data
transfer, and HTML, CSS and JavaScript for display and user interfacing. The
latest stable version of rails, 4.2.5 will be used in this project which was first
released on October 30, 2015.
3.7.2 MVC Framework
Model–view–controller (MVC) is a software architectural pattern mostly (but
not exclusively) for implementing user interfaces on computers. It divides a
given software application into three interconnected parts, so as to separate
internal representations of information from the ways that information is
presented to or accepted from the user.
Traditionally used for desktop graphical user interfaces (GUIs), this architecture
has become extremely popular for designing web applications.
Components
The central component of MVC, the model, captures the behavior of the
application in terms of its problem domain, independent of the user interface.
 A Model , which represents the underlying, logical structure of data in a
software application and the high-level class associated with it. This
object model does not contain any information about the user interface.
 A view can be any output representation of information, such as a chart or
a diagram. Multiple views of the same information are possible, such as a
bar chart for management and a tabular view for accountants.
 The third part, the controller, accepts input and converts it to commands
for the model or view. It represents the classes connecting the model and
the view and is used to communicate between classes in the model and
view.
Interactions
In addition to dividing the application into three kinds of components, the
model–view–controller design defines the interactions between them.
 A model stores data that is retrieved according to commands from the
controller and displayed in the view.
 A view generates an output presentation to the user based on changes in
the model.
33
 A controller can send commands to the model to update the model's state
(e.g. editing a document). It can also send commands to its associated
view to change the view's presentation of the model (e.g. by scrolling
through a document).
3.7.3 Java
Java is a general-purpose computer programming language that is concurrent,
class-based, object-oriented and specifically designed to have as few
implementation dependencies as possible. It is intended to let application
developers "write once, run anywhere", meaning that compiled Java code can run
on all platforms that support Java without the need for recompilation. Java
applications are typically compiled to bytecode that can run on any Java virtual
machine (JVM) regardless of computer architecture. As of 2016, Java is one of the
most popular programming languages in use, particularly for client-server web
applications. The latest version of Java, 1.8, will be used in this project which was
first released on March 18, 2014.
3.7.4 Apache Software Foundation
Apache Software Foundation (ASF) is an organization funded by donations and
sponsors. There are currently more than 350 Open Source projects overseen by
the ASF that is developed and maintained by volunteers all over the world. An
individual is awarded membership after they are nominated for it and the
majority of the ASF members approve this nomination. The ASF members
periodically elect Board of Directors which govern organizational affairs and the
operations of ASF.
The Apache Software Foundation is a decentralized community of developers.
The software they produce is distributed under the terms of the Apache License
and is free and open source software (FOSS). The Apache projects are
characterized by a collaborative, consensus-based development process and an
open and pragmatic software license. Each project is managed by a self-selected
team of technical experts who are active contributors to the project. The ASF is a
meritocracy, implying that membership of the foundation is granted only to
volunteers who have actively contributed to Apache projects. The ASF is
considered a second-generation open-source organization, in that commercial
support, is provided without the risk of platform lock-in.
Tomcat
Apache Tomcat, often referred to as Tomcat, is an open-source web server
developed by the Apache Software Foundation (ASF). Tomcat implements
several Java EE specifications including Java Servlet, JavaServer Pages (JSP), Java
EL, and WebSocket, and provides a "pure Java" HTTP web server environment
for Java code to run in. Tomcat version 8.0 is being used in the project.
34
Catalina is Tomcat's servlet container. Catalina implements Sun Microsystems'
specifications for servlet and JavaServer Pages (JSP). In Tomcat, a Realm element
represents a "database" of usernames, passwords, and roles (similar to Unix
groups) assigned to those users. Different implementations of Realm allow
Catalina to be integrated into environments where such authentication
information is already being created and maintained, and then use that
information to implement Container Managed Security as described in the
Servlet Specification.
Commons
Apache Commons is a large project focused on producing reusable Java
components on all aspects of Java. One of the Commons’ goal is to provide stable
and independent components so developers wouldn’t need to worry about
changes in the future. The Commons project is composed of three main parts that
provide over 70 components. The math component of the commons project is
included in the application to develop a regression model between energy
consumption and temperature.
3.7.5 RESTful API
RESTful Web Services are REST architecture based web services. In REST
Architecture everything is a resource. RESTful web services are lightweight,
highly scalable and maintainable and are very commonly used to create APIs for
web based applications.
REST stands for Representational State Transfer. REST is web standards based
architecture and uses HTTP Protocol for data communication. It revolves around
resource where every component is a resource and a resource is accessed by a
common interface using HTTP standard methods. REST was first introduced by
Roy Fielding in 2000.
In REST architecture, a REST Server simply provides access to resources and
REST client accesses and presents the resources. Here each resource is identified
by URIs/ global IDs. REST uses various representations to represent a resource
like text, JSON and XML. Nowadays JSON is the most popular format being used
in web services.
HTTP Methods
Following well-known HTTP methods are commonly used in REST based
architecture.
 GET - Provides a read-only access to a resource.
 PUT - Used to create a new resource.
 DELETE - Used to remove a resource.
 POST - Used to update an existing resource or create a new resource.
35
 OPTIONS - Used to get the supported operations on a resource.
RESTFul Web Services
A web service is a collection of open protocols and standards used for
exchanging data between applications or systems. Software applications written
in various programming languages and running on various platforms can use
web services to exchange data over computer networks like the Internet in a
manner similar to inter-process communication on a single computer. This
interoperability (e.g., between Java and Python, or Windows and Linux
applications) is due to the use of open standards.
Web services based on REST Architecture are known as RESTful web services.
These web services use HTTP methods to implement the concept of REST
architecture. A RESTful web service usually defines a URI, Uniform Resource
Identifier a service, provides resource representation such as JSON and set of
HTTP Methods.
JAX-RS stands for JAVA API for RESTful Web Services. JAX-RS is a JAVA based
programming language API and specification to provide support for created
RESTful Webservices. Its 2.0 version was released on 24 May 2013. JAX-RS
makes heavy use of annotations available from Java SE 5 to simplify development
of JAVA based web services creation and deployment. It also provides supports
for creating clients for RESTful web services.
Jersey, a reference implementation of JAX-RS 2.0 by Oracle, in RESTful Web
Services is implemented in the project.
3.7.6 HTML & AJAX
HTML is a markup language for describing web documents (web pages).
 HTML stands for Hyper Text Markup Language
 A markup language is a set of markup tags
 HTML documents are described by HTML tags
 Each HTML tag describes different document content
AJAX is a web development technique for creating interactive web applications.
3.7.7 MySQL
MySQL is a highly popular Open Source relational database management system
which will be the backing database of the system. Wattics has a MySQL database
which will be queried using the API to get data.
36
MySQL is a popular choice of database for use in web applications and is a central
component of the widely used LAMP open source web application software stack
(and other "AMP" stacks). LAMP is an acronym for "Linux, Apache, MySQL,
Perl/PHP/Python". Free-software open-source projects that require a full-
featured database management system often use MySQL.
3.7.8 Development Environment
The web application in Ruby on Rails will be developed using JetBrains
RubyMines IDE. The API will be built in a Java Development Environment in
Eclipse.
37
Chapter 4: Implementation
The application has been implemented with collaboration with Wattics.
The project has following main components:
1. Tamagreen Web application developed on Ruby on Rails
2. SQLLite DB in the web application
3. Tamagreen API developed in Java using Eclipse IDE
4. MySql DB at the server end
5. Wattics Database
4.1Tamagreen Web Application
The web application is developed using ruby on rails. It can be accessed using the
URL – www.tamagreen.wattics.com. It has following web pages included.
4.1.1 Homepage
The homepage or welcome page describes the application. It gives a basic idea of
what the web application is about. A carousel of relevant images is implemented.
Figure 4.1
The page has 3 buttons to navigate. Login, Register and How to use.
A bootstrap feature called carousel is used to navigate through the various
images in the welcome page. The images give a brief idea about the application.
<div class="carousel slide" id = "featured" data-ride="carousel" style="padding-
bottom:0px;">
38
4.1.2 Login Page
The login page enables the user to login to the application. There are validations
on this page such as user id and password are required fields. The username and
password must be correct or else an invalid details message is thrown.
Figure 4.2
The page checks if the logged in user is an admin and if it is, the user is navigated
to the administrative page or else the user is navigated to the configuration page.
The back button will take you back to the homepage.
4.1.3 Register
The register page enables one to register a new user. All the fields in the register
page are required to be filled to complete the registration process.
Users cannot use an already registered user id twice. Once the registration is
successful, the user needs to wait for an approval mail from the tamagreen team
to proceed further.
The details from the registration form are stored in the User table in SQLLite DB.
The register controller calls the create method of the active record class to create
a new entry in the user table.
@user = User.create(:username => @username.strip.downcase, :password => @pwd, :channel_id =>
@channelid, :status => "Pen", :emailid => params[:emailid][0])
The record is inserted with pending status.
39
Figure 4.3
The back button will redirect the user to the homepage.
The password is hashed before being stored in the database using the MD5 hash
algorithm. This is a one-way hash and not even the admin can retrieve the
password from the hash value stored in the database. This has been
implemented for additional security.
4.1.4 How to use
How to use page gives the user guidelines for using the application. The
guidelines are provided in steps which are well structured and along with images
to explain them. A new user can go through this page once to get an idea of how
the application works and how to use it.
40
Figure 4.4
The images in this page can be clicked which will then open a modal window
with the images. This is a nice feature to have a closer look at the images. This is
also implemented using bootstrap.
<div class="modal" role = "dialog" aria-labelledby="modalLabel" id="userpref" >
<div class="modal-dialog" role = "document">
<div class="modal-content">
<div class="modal-body">
<img class = "img-responsive centre-block img-rounded" border="0" width="602" height="294"
src="/assets/userpref.png"/>
</div>
<div class="modal-footer">
<button type = "button" class = "btn btn-default" data-dismiss = "modal">
Close
</button>
</div>
</div>
</div>
</div>
The back button will bring the user back to the homepage.
4.1.5 Configure Page
This is the page where the user configures the images for the corresponding
energy consumption values which will help the application to run.
The user will enter the criteria and upload images corresponding to the criteria.
The user can view the images uploaded by clicking on them.
The navigation buttons on the page include,
User preference
Logging
Logout
Run Tamagreen
41
Figure 4.5
The records inserted on this page are stored in Entry table in SQL Lite database.
For each entry corresponding image is stored in the assets folder in the
application. The image is given a unique name to identify itself for a specific
record. The images are clickable which will open up a modal window.
On clicking on the delete button, the record from the database is deleted and also
the image file in the assets folder.
Entry.destroy(id)
path = 'appassetsimages'+@entry.image_path
if File.exist?(path) then
File.delete(path)
end
4.1.6 User Preference
This Page allows the user to make changes to the user details like password,
meter-id, email address.
The page has validations on the text fields.
42
Figure 4.6
The changes made are updated in the database in the user table.
@user.update_attributes({:password => @pwd, :channel_id => @channelid,:emailid => @emailid})
If the password is changed it is also updated in the Java API which has a MySQL
database using update user API service.
doc =
Nokogiri::XML(open("http://localhost:8080/TamagreenAPI/rest/TamagreenService/updateuser"+"
/"+@user.username.to_s+"/"+@pwd.to_s,
:http_basic_authentication => [@admin.username, @admin.password]))
Nokogiri is used to open the URL. A basic HTTP authentication is implemented in
the URL which requires user authentication with admin role. This is further
discussed in the API implementation section.
4.1.7 Logging
The logging page enables the user to view the previous log and set the images
accordingly. The page shows the energy consumed and the expected energy
43
consumption of a particular time which can be referred to while configuring the
application.
Figure 4.7
The logs are stored in logs folder. Each user will have a unique log folder
associated with him. On every user login, the application will check if there is a
log file for that user if it is not the application will fetch the data from the API and
store it in the log file. At a particular time, a maximum of only 10 rows is logged
for a particular user.
begin
otherfunc = ::Function.new
path = "appassetslogs"+@username.strip.downcase+".log"
if @user != nil && !File.file?(path) then
currelecon =
otherfunc.getenergyconsumption(timestamp,@user.channel_id,@user.username,@user.password)
meanelecon =
otherfunc.getexpectedconsumption(timestamp,@user.channel_id,@user.username,@user.password)
if meanelecon == 0 then
@path = ""
else
otherfunc.calculateperc(meanelecon,currelecon)
otherfunc.getimage(@username)
File.open('appassetslogs'+@username.strip.downcase+'.log', "a") {|f| f.puts(currelecon.to_s + ","
+ meanelecon.to_s + "," + otherfunc.perc.to_s) }
if otherfunc.entry != "" then
@path = otherfunc.entry.image_path
else
@path = ""
end
end
end
rescue => ex
File.open('appassetslogs'+@user.username+'.log', "a") {|f| f.puts('0' + "," + '0' + "," + '0') }
end
44
4.1.8 Tamagreen
The run Tamagreen button runs the application and displays images that are
configured as per the energy consumption of the organisation.
The images to be displayed are displayed by calculating the offset percentage of
the actual energy consumption from the expected energy consumption. Nokogiri
is used to fetch these data from the Java API.
#Get actual energy consumption from the server
def getenergyconsumption(timestamp,channelid,username,password)
doc =
Nokogiri::XML(open("http://localhost:8080/TamagreenAPI/rest/TamagreenService/rawdata"+"/"+t
imestamp+"/"+channelid.to_s,
:http_basic_authentication => [username, password]))
p doc
elems = doc.xpath("//totalactivepower")
return elems[0].text.to_i
end
#Get expected energy consumption from the server
def getexpectedconsumption(timestamp,channelid,username,password)
doc =
Nokogiri::XML(open("http://localhost:8080/TamagreenAPI/rest/TamagreenService/expectedconsu
mption/"+timestamp+"/"+channelid.to_s,
:http_basic_authentication => [username, password]))
p doc
elems = doc.xpath("//expectedconsumption")
return elems[0].text.to_i
end
The API calls are made with basic HTTP authentication with the user's username
and password which is already present in the MySQL(API) database.
You can use the configure button to go back.
The page is refreshed automatically after every 5 seconds as specified.
<meta http-equiv="refresh" content="5" />
An organisation can use any type of image which seems fit for the end users. For
kids, in this case, gif images of a monkey character are being used.
45
Figure 4.8
4.1.9 User Admin Login
The user admin login page gives details about the registered users and also
enables the super admin to approve or delete any user. When the admin
approves a new user, the user details are also sent to the Java API to be stored in
the MySQL database.
doc =
Nokogiri::XML(open("http://localhost:8080/TamagreenAPI/rest/TamagreenService/adduser"+"/"+
@user.username.to_s+"/"+@user.password.to_s,
:http_basic_authentication => [@admin.username, @admin.password]))
These details are then used when getting data from the API to run the application
The approved user is notified by email of the approve action. The ruby gem used
to implement the mailing functionality is ActionMailer. It sends emails from the
mail server using SMTP protocol.
require 'action_mailer'
#Setting up the SMTP settings for email
ActionMailer::Base.smtp_settings = { :address => 'smtp.gmail.com',
:port => 25,
:domain => 'gmail.com',
:user_name => 'tamagreen.wattics@gmail.com',
46
:password => 'akhil343',
:authentication => :plain }
class SendMail < ActionMailer::Base
#sends email to the user
#formele is an object of FormElement with page level element attributes
def sendMailToUser(user)
mail(:from => 'DONOTREPLY@tamagreen.com',
:to => user.emailid,
:subject => 'Tamagreen Account Activation',
:body => "Hi "+user.username+",nn Welcome to Tamagreen. Your account has been activated.
Please login at www.tamagreen.wattics.com/login/login to continue. nnn Regards,nTamagreen
Team")
end
end
Additional Note:
The entire application is responsive and is developed using Bootstrap. The
forms and buttons used have bootstrap styles. Bootstrap is the most popular
HTML, CSS, and JavaScript framework for developing responsive, mobile-first
websites.
Every text box uses a placeholder to make it easier to understand what detail the
textbox is expecting. The tables used in the application are also responsive and
interactive. Modal windows have been used in the application in multiple places.
4.2 SQLLite Database in the web application
The application uses the sqlLite database in the rails application to store user
records. User details like user id, password, email address, metered are stored in
the application.
Also the images and their path, the log files are also stored in the application and
the metadata regarding these files are stored in sqlLite DB.
Ruby gem used to implement this functionality is the ActiveRecord.
Database schema:
create_table "entries", force: :cascade do |t|
t.string "level", limit: 255
t.integer "value"
t.string "compare", limit: 255
t.string "image_path", limit: 255
t.string "channel_id", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "userid"
end
create_table "users", force: :cascade do |t|
t.string "username", limit: 255
t.string "password", limit: 255
t.string "channel_id", limit: 255
47
t.string "status", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "emailid"
end
4.3 Tamagreen API developed in Java
There are four services developed in Java.
4.3.1 Get Energy Consumption
URL:
http://localhost:8080/TamagreenAPI/rest/TamagreenService/rawdata/{
datetime}/{meterid}
The URL will get the current energy consumption of the organisation from
Wattics database.
The URL will basically hit TamagreenAPI service which accesses the
electricity_raw table in the Wattics database which contains the data for the
organisation's energy consumption. The data is stored in three columns –
active_powerA, active_powerB, active_powerC which represents the three
phases.
The connection to Wattics database is obtained using JDBC connection.
The data is obtained using the timestamp passed in the URL. The values closest
to the timestamp is retrieved and sent in an XML response message which is then
read in the ruby application using ruby gem Nokogiri.
GET method of the RESTful service is used in this case.
@GET
@Path("/rawdata/{timestamp}/{channelid}")
@Produces(MediaType.APPLICATION_XML)
public RawData extractRawData(@PathParam("timestamp") String timestamp,
@PathParam("channelid") int channelid) throws SQLException{
return TamagreenLib.extractRawdata(timestamp,channelid);
}
48
4.3.2 Get Expected Energy Consumption
URL:
http://localhost:8080/TamagreenAPI/rest/TamagreenService/expectedco
nsumption/{datetime}/{meterid}
This URL hits the API service which calculates the expected consumption of the
organisation at the timestamp provide and sends the data back.
The function first retrieves the consumption data for the previous 7 working
days between 8 am to 2 pm(the working hours of the school).
try {
date = formatter.parse(datetime.substring(0, 10));
cal.setTime(date);
while (index < 8) {
dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
if(dayOfWeek != 1 && dayOfWeek != 7){
if(index ==0){
result = getDataFromDB(datetime.substring(0,
10),channelid);
}else{
result =
appendArray(result,getDataFromDB(datetime,channelid));
}
index += 1;
}
cal.add(Calendar.DATE, -1);
date = cal.getTime();
}
}
It then retrieves the outside temperature for each hour in these 7 days using
WeatherUndergroundAPI.
public double getHourlyWeather(String date,String hour) throws Exception{
double temp = 0.0;
TemperatureData td = new TemperatureData();
//hour = hour + ":00";
td = td.getTempDataFromDB(date,hour+":00");
if(td.isDataAvailable()){
return td.getTempValue();
}else{
DocumentBuilderFactory objDocumentBuilderFactory = null;
DocumentBuilder objDocumentBuilder = null;
Document doc = null;
Element ele = null;
String path =
"http://api.wunderground.com/api/497fcd91a89840b0/history_" + date +
"/q/Ireland/Dublin.xml";
InputStream stream = getWeatherFromAPI(path);
try {
49
objDocumentBuilderFactory =
DocumentBuilderFactory.newInstance();
objDocumentBuilder =
objDocumentBuilderFactory.newDocumentBuilder();
doc = objDocumentBuilder.parse(stream);
NodeList descNodes = doc.getElementsByTagName("hour");
for(int k = 8; k<=16; k++)
{
String hourCount = String.format("%02d", k);
//hour = hour + ":00";
for(int i=0; i<descNodes.getLength();i++)
{
if(descNodes.item(i).getTextContent().equalsIgnoreCase(hourCount)){
ele = (Element)
descNodes.item(i).getParentNode().getParentNode();
Double tempHour =
Double.parseDouble(ele.getElementsByTagName("tempm").item(0).getTextContent());
td.addTempDataToDB(date,hourCount+ ":00",String.valueOf(tempHour));
if(hour.equals(hourCount))
{
temp = tempHour;
}
break;
}
}
}
} catch (Exception ex) {
throw ex;
}
return temp;
}
}
It then uses simple regression with the data and calculates the expected energy
consumption on the timestamp with the current outside temperature.
public double CalcExpConsumption(double[][] data, double temp) {
SimpleRegression regression = new SimpleRegression();
regression.addData(data);
return regression.getSlope()*temp + regression.getIntercept();
}
The org.apache.commons.math3.stat.regression.SimpleRegression is used to calculate
simple regression
This data is then sent back to the rails application in an XML format which is then
read using Nokiogiri.
50
4.3.3 Add User
URL:
http://localhost:8080/TamagreenAPI/rest/TamagreenService/adduser/{u
sername}/{password}
This URL is used to add a newly registered user details to the MySQL database.
The user is added in role member. The two tables are
Tomcat_users
Tomcat_user_roles
4.3.4 Update User
URL:
http://localhost:8080/TamagreenAPI/rest/TamagreenService/updateuser
/{username}/{password}
This URL is triggered when an existing user password is updated. It updates the
user password in Tomcat_users table.
Additional Note:
RESTFul web services are used to create the API. javax.ws.rs package in java is
used. All the API URLs are authenticated using Basic HTTP Authentication.
Security constraints are added in web.xml to achieve this.
<security-constraint>
<web-resource-collection>
<web-resource-name>TamagreenService</web-resource-name>
<url-pattern>/rest/TamagreenService/*</url-pattern>
<http-method>GET</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>member</role-name>
</auth-constraint>
</security-constraint>
The URL for energy consumption require user authentication with role member
where the URL for user details requires user authentication with role admin. To
51
achieve the authentication to target the Tomcat_users table in MySQL database, a
JDBC realm is created in server.xml.
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://{servername}/tomcat_realm"
connectionName="{conn_username}" connectionPassword="****"
userTable="tomcat_users" userNameCol="user_name" userCredCol="password"
userRoleTable="tomcat_users_roles" roleNameCol="role_name" />
</Realm>
4.4 MySQL DB at the server
MySQL database is used in the API server in java to cache the temperature data
which is retrieved once so that repeated calls need not be made to the
WeatherUnderground API which is a third part API. This will increase the
speed and efficiency of the application. Only requests for any temperature data
which is not already present in the database will be made. The data is saved in
temperature_data table.
4.5 Wattics database
Wattics has a MySQL database deployed in amazon which is accessed using the
JDBC connection from the API server. The API server only has read access to the
database which will prevent from any changes being made to the database. All
the connections to the database are immediately closed after making any query
request so that it is memory efficient.
52
Apache Server
The rails application is deployed on an apache web server. It is distributed under
an “open source” license. A Web server is a software program that maps URL
requests from a Web client to a resource that will handle the request and return
a response to the client. The Web client and the Web server use HTTP to
communicate over a TCP network. Apache server is run on a Linux machine
launched in AWS. Putty is being used to connect to the Linux machine to activate
the server.
Tomcat Server
Tomcat server is used to deploy the API services. This is again run on the same
Linux machine.
Weather Underground API
WeatherUnderground is a third party API being used to get the temperature
data. I have registered myself on the weather underground website and use their
URL to get the data
URL:
To get the weather forecast for today:
http://api.wunderground.com/api/497fcd91a89840b0/geolookup/conditions/f
orecast/q/Ireland/Dublin.xml
To get the weather history data
http://api.wunderground.com/api/497fcd91a89840b0/history_{date}/q/Irelan
d/Dublin.xml
53
Chapter 5: Evaluation
5.1 Software Evaluation
Software evaluation was performed based on the various software used in
developing the application.
The application is implemented in two parts –
 Ruby rails web application
 Java API
 Wattics Meter
Ruby rails web application
The web application is implemented using Ruby version 2.0.0 and rails version
4.2.5. The application implements the MVC architecture provided by rails which
provide the object-oriented features like abstraction, inheritance, reusability, etc.
The Rails web application runs on an apache web server that processes requests
via HTTP. The application can run on any web browser and has no special
requirements or plug-ins that need to be installed.
The login and register functionality of the application is efficient requiring
unique user id for every registration. The browser URL shows the logged in user
Id but on changing the user id in the browser, it is redirected to the login page.
The user sessions are handled to identify the user that is logged in thus avoiding
unauthorized access.
Multiple users can access the application from a different browser at the same
time.
Java API
To implement the API java version 1.8 is being used. The API is deployed using
tomcat web server. The RESTful services implemented uses HTTP methods to
communicate with the application.
HTTP downloads each file over an independent connection and then closes the
connection. This reduces the risk of interception during transmission, as the
connection does not persist beyond the transfer of a single element of a Web
page. Hypertext Transfer Protocol Secure (HTTPS) encrypts the HTTP exchange
to add further security.
The server can handle multiple requests at a time. The system is not currently
implemented to handle a high amount of requests since it is implemented for a
single school, but a queuing of the requests can be implemented later on to
increase the efficiency of the application.
54
The API is authenticated using basic HTTP authentication which secures it from
unauthorized access.
Wattics Meter
The Wattics meter is active 24/7 and transmits real-time energy consumption
information to the Wattics server which is then stored in Wattics database.
The meter requires an active internet connection to work.
5.2 Application Evaluation
The evaluation of the web application is based on a short survey completed by a
group of 25 individuals including school students, college students, and
corporate professionals. The group was given the link to the application and
asked to go through it without giving any prior knowledge of what the
application was about. The survey provided very positive feedback on the
application from the group.
Every individual among the group agreed that they feel the application is a very
positive approach towards reducing energy consumption and encouraging green
energy.
None among the group found any difficulty in understanding the purpose or the
usage of the application. In fact, 45.83% termed the application as very easy to
use and the rest 54.17% termed it as easy to use. Refer Figure 5.1.
Figure 5.1
Is the application easy to
understand and use?
Very Easy
Easy
Difficult
Did not understand
55
The application has been developed for encouraging young kids to develop an
awareness of energy conservation among young kids. From a rating of 1 to 5(5
being most likely) of the effectiveness of this concept, 47.83% gave it the
maximum rating of 5, 43.48% agreed on 4 whereas 8.70% gave it a rating of 3.
This shows that the general conception of the effectiveness of the web
application is quite positive. Refer Figure 5.2.
Figure 5.2
The application will be using images or gifs to get young minds to be encouraged
about saving energy based on the motions shown in the images. This is a
different approach that will connect with the kids better rather than showing any
figures. These images can be any cartoon character like a monkey. 58.33% of the
survey group gave a rating of 5(from 1-5, 5 being most likely) to the effectiveness
of this approach, 33.33% gave a rating of 4 and 8.33% gave a rating of 3. Refer
Figure 5.3.
Figure 5.3
56
An important aspect to achieve effective energy consumption is to bring about a
change in the consumption behaviour of the users. Everyone in the test group
agreed that the application will bring a change in the users’ consumption
behaviour which will be beneficial for reducing energy consumption.
From the individuals that took the survey, 37.50% termed the application as
Innovative, another 37.50% termed it as Effective and 25% termed it as Easy to
use and understand. From the results, it seems the general conception about the
application is a combination of all the three factors since all the three got almost
equal votes. Refer Figure 5.4.
Figure 5.4
Finally, when asked how likely will the application is to be suggested in an
organisation by the individual, 50% gave it a rating of 5(from 1-5, 5 being most
likely), 33.3% gave it a rating of 4 and 16.67% gave it a rating of 3. Refer Figure
5.5.
57
Figure 5.5
The survey suggested that the application has a good scope to be popular and be
customized and used in various organisations to make the user energy aware by
giving appropriate feedback and thus affect their energy consumption behaviour.
58
Chapter 6: Future Work
The application is developed for young kids to develop energy awareness among
them. It aims to affect the energy consumption behaviour of young kids. The
application is currently developed for only a single school. But the application is
scalable enough to accommodate multiple institutions by just increasing the
database memory. Multiple schools can then collaborate with each other to
encourage students to compete with each other and achieve a reduction in
energy use. The application can be incorporate features to enable comparing the
consumption data between two or more institutions in a graphical and
interactive way like the app itself.
This concept can be further customized to target a larger audience in other
organisations as well. The application can target adult users which will, in turn,
have a greater impact on energy conservation.
The application can also be implemented at a national level at various
institutions and organisations which can help reach the EU target of 20% energy
efficiency by 2020. As per EU directive, energy distributors or retail energy sales
companies have to achieve 1.5% energy savings per year through the
implementation of energy efficiency measures. The application can be
incorporated as one such energy efficiency measure.
59
Chapter 7: Conclusion
Energy conservation is the need for the day. The application tries to bring about
a positive change in the behaviour of energy users. The application target young
kids. The application has an effective and technological approach by connecting
with the kids using cartoon images and graphics.
The application gives a visual feedback on the basis of the energy consumption
data in your organisation. It uses images the user have configured to give a visual
feedback on the offset between the actual energy consumed by the organisation
and the expected energy consumption based on past data keeping in account the
outside temperature. The application uses smart meters provided by Wattics to
read the energy consumption of your organisation.
The application explores various technologies like Ruby rails, Java, MySQL. It
implements a Java API using RESTFul services and also makes use of third party
APIs to get temperature data. The web pages are implemented using bootstrap
which makes it responsive and interactive. Young children are the future of our
generation. Influencing them to be aware of the energy consumed in their
surroundings like schools, homes, etc. is a good approach towards future energy
conservation.
The evaluation performed on the application provides very positive feedback
from the users who used the application. It has a very good potential to make a
positive impact in the energy consumption behaviours of the users. As per the
evaluation results, the application has scope to develop further and be
implemented on a larger scale.
The 2012 Energy Efficiency Directive establishes a set of binding measures to
help the EU reach its 20% energy efficiency target by 2020. Under the Directive,
all EU countries are required to use energy more efficiently at all stages of the
energy chain from its production to its final consumption. Tamagreen application
and other such energy efficiency measures can help the EU nations achieve their
target.
60
Chapter 8: References
 Tippenergyie. (2015). Tipperary Energy Agency. Retrieved 27 June, 2016, from
http://tippenergy.ie/energy-awareness-programme-for-schools-programmes-for-
children-and-teachers/
 Youriscom. (2016). Youriscom. Retrieved 27 June, 2016, from
http://www.youris.com/Society/Daily_Life/When_Energy-Saving_Becomes_A_Game.kl
 Githubio. (2016). Githubio. Retrieved 3 June, 2016, from http://eis-
bonn.github.io/Theses/2015/Theresa_Otte/thesis.pdf
 Energyawarenesseu. (2016). Energyawarenesseu. Retrieved 27 June, 2016, from
http://www.energyawareness.eu/beaware/uploads/BeAware_leaflet.pdf
 Europaeu. (2016). Europaeu. Retrieved 23 June, 2016, from
http://ec.europa.eu/research/energy/eu/index_en.cfm?pg=policy
 Europaeu. (2016). Europaeu. Retrieved 29 June, 2016, from
http://www.eea.europa.eu/publications/achieving-energy-efficiency-through-
behaviour/download
 Arrowditie. (2016). Arrowditie. Retrieved 20 June, 2016, from
http://arrow.dit.ie/cgi/viewcontent.cgi?article=1138
 Stanfordedu. (2016). Stanfordedu. Retrieved 27 June, 2016, from
http://web.stanford.edu/class/me221/readings/Persuasive_Tech_Sustainable_Behavior
.pdf
Technical Software References
 Rubyonrailsorg. (2016). Rubyonrailsorg. Retrieved 14 June, 2016, from
http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html
 Tutorialspointcom. (2016). Wwwtutorialspointcom. Retrieved 24 June, 2016, from
http://www.tutorialspoint.com/restful/
 Instructablescom. (2016). Instructablescom. Retrieved 26 June, 2016, from
http://www.instructables.com/id/Implement-Your-Own-API-in-Java-Using-
Eclipse/step5/Add-JAR-to-Build-Path/
 Oraclecom. (2016). Oraclecom. Retrieved 14 July, 2016, from
http://docs.oracle.com/javase/tutorial/jdbc/overview/index.html
 Rubygemsorg. (2016). Rubygemsorg. Retrieved 14 July, 2016, from
http://guides.rubygems.org/command-reference/
 Theopentutorialscom. (2016). Theopentutorialscom. Retrieved 29 June, 2016, from
http://theopentutorials.com/examples/java-ee/jax-ws/create-and-consume-web-
service-using-jax-ws/
 Crunchifycom. (2012). Crunchify. Retrieved 09 July, 2016, from
http://crunchify.com/how-to-build-restful-service-with-java-using-jax-rs-and-jersey/
 Avajavacom. (2016). Avajavacom. Retrieved 13 July, 2016, from
http://www.avajava.com/tutorials/lessons/how-do-i-use-form-authentication-with-
tomcat.html
 Avajavacom. (2016). Avajavacom. Retrieved 22 July, 2016, from
http://www.avajava.com/tutorials/lessons/how-do-i-use-a-jdbc-realm-with-tomcat-and-
mysql.html?page=2

More Related Content

What's hot

Sara Walton “Lighting in Vanuatu: understanding rapid technological change.”
Sara Walton “Lighting in Vanuatu: understanding rapid technological change.”Sara Walton “Lighting in Vanuatu: understanding rapid technological change.”
Sara Walton “Lighting in Vanuatu: understanding rapid technological change.”Energy Cultures 2 Janet Stephenson
 
Motives and barriers to household adoptation of small scale production of ele...
Motives and barriers to household adoptation of small scale production of ele...Motives and barriers to household adoptation of small scale production of ele...
Motives and barriers to household adoptation of small scale production of ele...Maria Tengvard
 
Kajsa Ellegard “on the success of energy conservation in the household sector...
Kajsa Ellegard “on the success of energy conservation in the household sector...Kajsa Ellegard “on the success of energy conservation in the household sector...
Kajsa Ellegard “on the success of energy conservation in the household sector...Energy Cultures 2 Janet Stephenson
 
Dragonfly solutions 2013
Dragonfly solutions 2013Dragonfly solutions 2013
Dragonfly solutions 2013L. Brent Ivie
 
Real Time Energy Feedback
Real Time Energy FeedbackReal Time Energy Feedback
Real Time Energy FeedbackDanny Tuff
 
Innovation ecosystem factsheet
Innovation ecosystem factsheetInnovation ecosystem factsheet
Innovation ecosystem factsheetSo Calie
 
Microgrids: Game Changing Solutions (Webinar)
Microgrids: Game Changing Solutions (Webinar)Microgrids: Game Changing Solutions (Webinar)
Microgrids: Game Changing Solutions (Webinar)Social Media Today
 
Built Environment Solutions that work
Built Environment Solutions that workBuilt Environment Solutions that work
Built Environment Solutions that workNLandUSA
 
Energy Efficiency Loan Program
Energy Efficiency Loan ProgramEnergy Efficiency Loan Program
Energy Efficiency Loan ProgramTNenergy
 
Solar Energy at the Student Life Center
Solar Energy at the Student Life CenterSolar Energy at the Student Life Center
Solar Energy at the Student Life CenterAmyDeSa
 
The Role of Information for Electricity Consumption: Smart Metering, Expert A...
The Role of Information for Electricity Consumption: Smart Metering, Expert A...The Role of Information for Electricity Consumption: Smart Metering, Expert A...
The Role of Information for Electricity Consumption: Smart Metering, Expert A...IEA DSM Implementing Agreement (IA)
 
ICS 690 talk: Personal Environmental Trainer
ICS 690 talk: Personal Environmental TrainerICS 690 talk: Personal Environmental Trainer
ICS 690 talk: Personal Environmental TrainerRobert Brewer
 
Npower SME Q1 2013 Billing Booklet
Npower SME Q1 2013 Billing BookletNpower SME Q1 2013 Billing Booklet
Npower SME Q1 2013 Billing Bookletnpower_pdf
 
Advanced metering-initiatives
Advanced metering-initiativesAdvanced metering-initiatives
Advanced metering-initiativesDiego Fettermann
 
Public Understanding of Renewable Energy Technologies in Nigeria: Implication...
Public Understanding of Renewable Energy Technologies in Nigeria: Implication...Public Understanding of Renewable Energy Technologies in Nigeria: Implication...
Public Understanding of Renewable Energy Technologies in Nigeria: Implication...Nigeria Alternative Energy Expo
 

What's hot (20)

Sara Walton “Lighting in Vanuatu: understanding rapid technological change.”
Sara Walton “Lighting in Vanuatu: understanding rapid technological change.”Sara Walton “Lighting in Vanuatu: understanding rapid technological change.”
Sara Walton “Lighting in Vanuatu: understanding rapid technological change.”
 
Motives and barriers to household adoptation of small scale production of ele...
Motives and barriers to household adoptation of small scale production of ele...Motives and barriers to household adoptation of small scale production of ele...
Motives and barriers to household adoptation of small scale production of ele...
 
Kajsa Ellegard “on the success of energy conservation in the household sector...
Kajsa Ellegard “on the success of energy conservation in the household sector...Kajsa Ellegard “on the success of energy conservation in the household sector...
Kajsa Ellegard “on the success of energy conservation in the household sector...
 
Dragonfly solutions 2013
Dragonfly solutions 2013Dragonfly solutions 2013
Dragonfly solutions 2013
 
Real Time Energy Feedback
Real Time Energy FeedbackReal Time Energy Feedback
Real Time Energy Feedback
 
Energy Efficiency Projects: lighting toolkit
Energy Efficiency Projects: lighting toolkitEnergy Efficiency Projects: lighting toolkit
Energy Efficiency Projects: lighting toolkit
 
Innovation ecosystem factsheet
Innovation ecosystem factsheetInnovation ecosystem factsheet
Innovation ecosystem factsheet
 
Microgrids: Game Changing Solutions (Webinar)
Microgrids: Game Changing Solutions (Webinar)Microgrids: Game Changing Solutions (Webinar)
Microgrids: Game Changing Solutions (Webinar)
 
Built Environment Solutions that work
Built Environment Solutions that workBuilt Environment Solutions that work
Built Environment Solutions that work
 
Formato SENA Ingles
Formato SENA InglesFormato SENA Ingles
Formato SENA Ingles
 
Energy Efficiency Loan Program
Energy Efficiency Loan ProgramEnergy Efficiency Loan Program
Energy Efficiency Loan Program
 
Solar Energy at the Student Life Center
Solar Energy at the Student Life CenterSolar Energy at the Student Life Center
Solar Energy at the Student Life Center
 
Energy Conservation 2.0: Can Devices Deliver?
Energy Conservation 2.0: Can Devices Deliver?Energy Conservation 2.0: Can Devices Deliver?
Energy Conservation 2.0: Can Devices Deliver?
 
The Role of Information for Electricity Consumption: Smart Metering, Expert A...
The Role of Information for Electricity Consumption: Smart Metering, Expert A...The Role of Information for Electricity Consumption: Smart Metering, Expert A...
The Role of Information for Electricity Consumption: Smart Metering, Expert A...
 
ICS 690 talk: Personal Environmental Trainer
ICS 690 talk: Personal Environmental TrainerICS 690 talk: Personal Environmental Trainer
ICS 690 talk: Personal Environmental Trainer
 
Npower SME Q1 2013 Billing Booklet
Npower SME Q1 2013 Billing BookletNpower SME Q1 2013 Billing Booklet
Npower SME Q1 2013 Billing Booklet
 
Cusolarslides
CusolarslidesCusolarslides
Cusolarslides
 
Advanced metering-initiatives
Advanced metering-initiativesAdvanced metering-initiatives
Advanced metering-initiatives
 
BOOK
BOOKBOOK
BOOK
 
Public Understanding of Renewable Energy Technologies in Nigeria: Implication...
Public Understanding of Renewable Energy Technologies in Nigeria: Implication...Public Understanding of Renewable Energy Technologies in Nigeria: Implication...
Public Understanding of Renewable Energy Technologies in Nigeria: Implication...
 

Similar to Akhil_Ravindran_15201336_Thesis_NL

ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGS”
ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGS” ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGS”
ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGS” IAEME Publication
 
ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGS
ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGSENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGS
ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGSIAEME Publication
 
Innovations in Sustainable Energy: A Deep Dive into Corporate Electric's Rene...
Innovations in Sustainable Energy: A Deep Dive into Corporate Electric's Rene...Innovations in Sustainable Energy: A Deep Dive into Corporate Electric's Rene...
Innovations in Sustainable Energy: A Deep Dive into Corporate Electric's Rene...Antonio Barrett
 
FINAL COMMUNICATION AND BUSINESS REPORT
FINAL COMMUNICATION AND BUSINESS REPORTFINAL COMMUNICATION AND BUSINESS REPORT
FINAL COMMUNICATION AND BUSINESS REPORTFabienne Colas
 
Guide for energy saving
Guide for energy savingGuide for energy saving
Guide for energy savingBhushan Pagar
 
Britishpsychologicalsociety
BritishpsychologicalsocietyBritishpsychologicalsociety
BritishpsychologicalsocietyAhmad Eid
 
Carragher, 2009, Surrey
Carragher, 2009, SurreyCarragher, 2009, Surrey
Carragher, 2009, Surreycahir90
 
Energy efficiency presentation
Energy efficiency presentation Energy efficiency presentation
Energy efficiency presentation ibra1993
 
Barriers to Improved Energy Efficiency Measures in the UK Housing Sector: Sta...
Barriers to Improved Energy Efficiency Measures in the UK Housing Sector: Sta...Barriers to Improved Energy Efficiency Measures in the UK Housing Sector: Sta...
Barriers to Improved Energy Efficiency Measures in the UK Housing Sector: Sta...Dr Renuka Thakore
 
Cost and Benefit Analysis of Solar Panels at Home
Cost and Benefit Analysis of Solar Panels at HomeCost and Benefit Analysis of Solar Panels at Home
Cost and Benefit Analysis of Solar Panels at HomeIJAEMSJORNAL
 
Rexel foundation for a better energy future brochure
Rexel foundation for a better energy future brochureRexel foundation for a better energy future brochure
Rexel foundation for a better energy future brochureEnergy 3.0
 
Applying behavioural insights to demand side energy policies and programmes: ...
Applying behavioural insights to demand side energy policies and programmes: ...Applying behavioural insights to demand side energy policies and programmes: ...
Applying behavioural insights to demand side energy policies and programmes: ...Leonardo ENERGY
 
Adding Psychological Factor in the Model of Electricity Consumption in Office...
Adding Psychological Factor in the Model of Electricity Consumption in Office...Adding Psychological Factor in the Model of Electricity Consumption in Office...
Adding Psychological Factor in the Model of Electricity Consumption in Office...IJECEIAES
 
Policy Brief - Residential Energy Efficiency Augmenting Existing Policies
Policy Brief - Residential Energy Efficiency Augmenting Existing PoliciesPolicy Brief - Residential Energy Efficiency Augmenting Existing Policies
Policy Brief - Residential Energy Efficiency Augmenting Existing PoliciesPrathmesh Gupta
 
energy assessments5
energy assessments5energy assessments5
energy assessments5Steve Tester
 
The energy audit RMEI general assembly
The energy audit RMEI general assemblyThe energy audit RMEI general assembly
The energy audit RMEI general assemblyTheEnergyAudit
 

Similar to Akhil_Ravindran_15201336_Thesis_NL (20)

Research paper
Research paperResearch paper
Research paper
 
ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGS”
ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGS” ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGS”
ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGS”
 
ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGS
ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGSENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGS
ENHANCEMENT OF ELECTRICAL ENERGY EFFICIENCY BY “INTERNET OF THINGS
 
Innovations in Sustainable Energy: A Deep Dive into Corporate Electric's Rene...
Innovations in Sustainable Energy: A Deep Dive into Corporate Electric's Rene...Innovations in Sustainable Energy: A Deep Dive into Corporate Electric's Rene...
Innovations in Sustainable Energy: A Deep Dive into Corporate Electric's Rene...
 
FINAL COMMUNICATION AND BUSINESS REPORT
FINAL COMMUNICATION AND BUSINESS REPORTFINAL COMMUNICATION AND BUSINESS REPORT
FINAL COMMUNICATION AND BUSINESS REPORT
 
Guide for energy saving
Guide for energy savingGuide for energy saving
Guide for energy saving
 
Britishpsychologicalsociety
BritishpsychologicalsocietyBritishpsychologicalsociety
Britishpsychologicalsociety
 
Ijciet 10 01_151-2
Ijciet 10 01_151-2Ijciet 10 01_151-2
Ijciet 10 01_151-2
 
Carragher, 2009, Surrey
Carragher, 2009, SurreyCarragher, 2009, Surrey
Carragher, 2009, Surrey
 
Energy efficiency presentation
Energy efficiency presentation Energy efficiency presentation
Energy efficiency presentation
 
Barriers to Improved Energy Efficiency Measures in the UK Housing Sector: Sta...
Barriers to Improved Energy Efficiency Measures in the UK Housing Sector: Sta...Barriers to Improved Energy Efficiency Measures in the UK Housing Sector: Sta...
Barriers to Improved Energy Efficiency Measures in the UK Housing Sector: Sta...
 
Cost and Benefit Analysis of Solar Panels at Home
Cost and Benefit Analysis of Solar Panels at HomeCost and Benefit Analysis of Solar Panels at Home
Cost and Benefit Analysis of Solar Panels at Home
 
Fritillaries5-1
Fritillaries5-1Fritillaries5-1
Fritillaries5-1
 
Rexel foundation for a better energy future brochure
Rexel foundation for a better energy future brochureRexel foundation for a better energy future brochure
Rexel foundation for a better energy future brochure
 
Applying behavioural insights to demand side energy policies and programmes: ...
Applying behavioural insights to demand side energy policies and programmes: ...Applying behavioural insights to demand side energy policies and programmes: ...
Applying behavioural insights to demand side energy policies and programmes: ...
 
Adding Psychological Factor in the Model of Electricity Consumption in Office...
Adding Psychological Factor in the Model of Electricity Consumption in Office...Adding Psychological Factor in the Model of Electricity Consumption in Office...
Adding Psychological Factor in the Model of Electricity Consumption in Office...
 
Policy Brief - Residential Energy Efficiency Augmenting Existing Policies
Policy Brief - Residential Energy Efficiency Augmenting Existing PoliciesPolicy Brief - Residential Energy Efficiency Augmenting Existing Policies
Policy Brief - Residential Energy Efficiency Augmenting Existing Policies
 
energy assessments5
energy assessments5energy assessments5
energy assessments5
 
The energy audit RMEI general assembly
The energy audit RMEI general assemblyThe energy audit RMEI general assembly
The energy audit RMEI general assembly
 
Scription
ScriptionScription
Scription
 

Akhil_Ravindran_15201336_Thesis_NL

  • 1. 0 Tamagreen: A Green Tamagotchi Akhil Ravindran A thesis submitted in part fulfillment of the degree of MSc. Computer Science by Negotiated Learning with the supervision of Assos. Professor Eleni Mangina School of Computer Science University College Dublin August 2016
  • 2. 1 ACKNOWLEDGEMENTS I would like to thank the firm Wattics for providing me with the hardware device which is an integral part of my application. Wattics team has helped me in setting up my application and also guided me with the initial requirements. Antonio, CEO of Wattics has guided me throughout the application development and also let me work in the Wattics office. Alex and Michele, the lead developers at Wattics were the first point of contact for me for any technical issues I would also like to thank my supervisor Eleni, for her continuous guidance that has helped me to complete my application and thesis. Last but not the least I would like to thank all my friends and family for their support.
  • 3. 2 DECLARATION “I hereby certify that this dissertation is entirely my own work. Neither the work nor parts thereof have been published elsewhere in either paper or electronic form unless indicated otherwise through referencing”. Signed: ___________________________________ Date: _______15-08-2016 ______________ Akhil Ravindran
  • 4. 3 MOTIVATION The following thesis is basically about making young kids aware about energy consumption and the effects it has on the environment. Energy conservation is unquestionably of great importance to everyone since we rely on energy for everything we do in our daily lives. Energy supplies are exhaustive and to maintain a good quality of life we need to use energy wisely. It is very important to inculcate the concept of energy awareness in young scholars. They are our future and making them realise the importance of conserving energy and using it only if required will be an important step in the ultimate goal of reducing worldwide energy consumption in the future. A popular way of making people use less energy is by bringing about a change in their energy consumption behaviour. Young minds are vulnerable and easy to mould, hence embedding the importance of energy consumption in these minds will help make a big difference in their future actions as adults. The application proposes a visual and fun way for kids by making use of kid-friendly images or gifs to encourage children towards becoming energy aware and consumes less energy whenever and wherever possible. The application will always provide real-time feedback to get the attention from these young minds by bringing about changes in the images displayed by reading their energy behaviour. Lastly, the application has the scope of implementing various new technologies and features which can make it develop further and be used in corporate organisations and also household apartments. Intelligent energy use is the need for the day. Many efforts are being taken to conserve energy and use existing energy wisely on a global scale.
  • 5. 4 CONTENTS 1 Introduction………………………………………………………………………………………...5 2 Literature Review…………………………………………………………………………………6 3 Analysis and Design……………………………………………………………………………18 4 Implementation………………………………………………………………………………….37 5 Evaluation………………………………………………………………………………………….53 6 Future Work………………………………………………………………………………………58 7 Conclusion…………………………………………………………………………………………59 8 References…………………………………………………………………………………………60
  • 6. 5 Chapter 1: Introduction Energy awareness is the need for the day currently. Making young scholars aware about energy conservation at a young age is very important and difficult at the same time. We are introducing a Tamagreen project which will help make young scholars pay more attention to be aware of the amount of energy consumed by them and thus make them know the importance of energy consumption. The application will be displaying some pre-defined images to the young kids as per the energy consumption of their school. With reduced energy consumption will display some positive images whereas increased energy consumption will display negative images. The response of the application will be real time as per the current energy consumption at the school. This will encourage the students to use the energy efficiently. The application aims to provide a user-friendly interface to the school staff where they will be able to configure the application with images that will be intriguing to the young kids. The user will be able to log in and set any kind of image for the application corresponding to the energy consumption criteria. Wattics is an energy analytics firm which will be providing a smart meter to be installed in the school using which energy consumption data will be collected. The application will implement a Java API to retrieve data from Wattics database. The application will also take the outside temperature into consideration while predicting the energy consumption data. The following thesis will be describing the functionality and the implementation of the application further.
  • 7. 6 Chapter 2: Literature Review 2.1 Introduction Conserving energy is the best way to ensure sustainable energy and reduce greenhouse gases. Energy conservation is a major issue currently and has been addressed in many EU programmes. Energy can be saved through increased energy efficiency or reduced energy consumption. In today’s world, energy consumption is a matter of utmost importance. The amount of energy required is exponentially increasing. Saving energy is a challenge globally faced due to the increase in energy demand. The only way to tackle the problem is to consume energy efficiently or use only what is required thus conserving it. Energy conservation differs from efficient energy use, which refers to using less energy for a constant service. Even though energy conservation reduces energy services, it can result in increased environmental quality, national security and personal financial security. It is at the top of the sustainable energy hierarchy. It also lowers energy costs by preventing future resource depletion. One way to achieve this is having rules and regulations imposed by the government. The other way can be by research. Finding out new ways to conserve or use less energy with the help of technology. This can be achieved only through research of current and existing energy consumption methods and consumer attitude towards energy conservation.
  • 8. 7 2.2 Review of Literature The European Union has its own agenda for energy conservation. The Conclusions of the European Council of 8–9 March 2007 emphasised the need for the European Union (EU) to achieve the objective of saving 20 % of primary energy consumption by 2020, compared to projections. The European Council of 4 February 2011 emphasised that the 2020 target must be delivered, but also recognised that the Member States are not on track to fulfil this commitment. On reaction to this on October 2012, the European Union adopted the Energy Efficiency Directive to achieve a reduction by 20% in energy consumption by 2020. The implementation of this directive and other policies that have been adopted in recent years will require a change in consumer behaviour and energy consumption practices. On analysis of recent available literature, it is found that consumer behaviour is mostly affected by combining direct and indirect feedback from energy suppliers. Direct feedback involves information received from computer or smart electronic meters whereas indirect feedback involves electricity bills. An EEA technical report – “Achieving energy efficiency through behaviour change” says that the major factor affecting consumer behaviour are energy feedback, energy audits and community-based initiatives. The research suggests that only technical implementation will not be successful to achieve reduced energy consumption. The technical implementations are more expensive to achieve in isolation. It needs to be combined with a behaviour change programme which can achieve energy consumption awareness in consumers more effectively. Consumption behaviour of an individual basically depends on the needs, opportunities, belief system and abilities. Behaviour change programmes can be different in domestic and non-domestic environments since households have a direct connection between their energy consumption behaviour and monthly costs whereas the effect of behavioural changes in the non-domestic environment is affected at the organisational level and an individual employee is not affected directly by it. The motivation for employees to engage in energy efficiency behaviours is therefore very different and must rely on corporate and social responsibility objectives and reinforce societal norms. Goal or target setting is another way to indulge households in energy saving. Households can decide for themselves and commit to a target to achieve. Research (Becker, 1978) found that not only did the level of the target have an influence on how well people perform in energy saving, but that an energy- saving target combined with feedback resulted in higher savings. This indicates that feedback can help households determine how close they are to achieving their goal. Becker's research looked at the electricity use of 80 families in the United States who were asked to set either an easy (2 %) or a difficult (20 %)
  • 9. 8 energy-saving goal. The sample was further divided into those who received feedback three times a week and those who did not receive feedback. A control group of additional 20 families received neither a goal nor feedback Energy audits have been instrumental in advancing energy efficiency in Europe for many years. More specifically, Article 8 of the Energy Efficiency Directive includes recommendations for Member States to promote energy audit activities in the small and medium-sized enterprise (SME) sector and makes energy audits mandatory for large enterprises. In addition, the directive encourages the Member States to raise awareness about the benefits of energy audits among households. 2.2.1 Use Case: the Norwegian Industrial Energy Efficiency Network (IEEN) The IEEN was established in 1989 by the Ministry of Petroleum and Energy in Norway to stimulate energy efficiency measures. The programme was instrumental in identifying and realising the industrial energy efficiency potential in the mid-1990s. A total of 900 companies (two-thirds being SMEs) participated in the programme. At that time, the Norwegian government set up an energy-saving target of 43 PJ/year to be achieved by 2010, out of which 9 PJ/y were expected to be delivered by the industry through energy efficiency measures and switching to renewable energy. Community-based initiatives by undertaking energy awareness programmes are a new way of bringing about pro-environmental behaviour change. Within the framework of such initiatives, small groups of people gather together and decide on a range of behaviours and attitudes that can be changed either to reduce their overall environmental footprint and/or to increase energy efficiency, in a report group format. The group size varies: from less than 10 people to more than 100, but in some cases reaching 1000 individuals. The group meets regularly and is given access to reliable information through written material and/or access to a trained expert. The group studies the information available and decides on the range of behaviours to be changed for the purpose of reducing their overall environmental impact and/or reducing energy consumption. 2.2.2 Dynamic Pricing Pricing is one of the factors that can be used to change consumer behaviour in energy consumption. Dynamic pricing refers to change in the cost of energy as per demand or the time when the energy is used. For eg., if there is high demand the pricing will be higher thus making the consumer to use less. Similarly, in any particular time of the day, the price may vary. Dynamic pricing can also be imposed on the amount of consumption of energy i.e. if the consumption is greater than a certain limit the price will be higher. Smart meters have enabled to introduced dynamic pricing in energy costs.
  • 10. 9 2.3 Use Case Of Smart Meters 2.3.1 The NRGi smart meter roll-out programme Between 2009 and 2012, NRGi, a Danish energy company, installed 210 000 smart meters throughout their customer base. The primary objective of the programme was to prepare their service network for the future with better opportunities to spread the load and cheaper ways to maintain the grid. Changing consumer behaviour or achieving energy savings were not factored specifically into the programme. In fact, according to a company representative, one of the bigger challenges they encountered during the roll-out was explaining to their customers why there is a need for a new meter and why new features are being added. Customers have the option to view their energy consumption via smartphone or the Web, but the company did not observe much interest on the part of the consumers in these feedback options. 2.3.2 The Swedish experience with smart meters The energy market in Sweden was opened in 1996. The smart meter roll-out programme started back in 2006 and was finalised in 2009 when mandatory monthly meter reading was introduced for all 5.2 million customers throughout the country. As of October 2012, all customers can have hourly readings if they wish, but this granularity is mandatory for customers in tertiary and industrial sectors. In May 2012, the Swedish government appointed the Coordination Council for Smart Grid, whose role is to 'coordinate and stimulate cooperation and knowledge transfer between different actors in the area of smart grid and deliver proposals to accelerate the development of smart grid in Sweden'. Various studies have shown that a purely technological approach to reduce energy consumption often leads to disappointing results due to changes in user behaviour, which have been described as rebound effects. The rebound effect or take-back effect is the term used to describe the impact lower costs of energy services (due to increased energy efficiency) have on consumer behaviour, both individually and nationally. Put simply, the 'rebound' effect is the extent to which the energy saving generated through energy efficiency measures is taken back by consumers in the form of higher consumption, either by increasing the quantity of energy used (for instance to increase their comfort levels) or due to a higher quality of energy service. Also, resistance to new systems and negative experiences, for example, due to faulty automation or lacking user friendliness, has frustrated the high hopes of innovative technologies. On the other hand, the effects of purely behavioural approaches have been very successful neither or mixed at best (e.g. Weenig & Midden, 1997). One of the main reasons for the lack of success is that most communication programs targeted the intentions of users, but largely ignored the technical context in which consumption choices actually occur. Basically, we view energy efficiency and conservation as the outcomes of multiple interactions
  • 11. 10 between technological systems and human users. It follows that interventions that aim to influence consumption behaviour should be concentrating on guiding interactions between users and systems. One of the quality issues encountered during the review was related to the fact that the analysis of behaviour change measures was based on limited attitudinal surveys; the projects did not always measure the impact on energy consumption. Some reports did identify measured reductions in energy use, while others investigated only the shift between peak and off-peak demand. Prior to the 1990’s, experiments using electronic devices indicated that they might contribute to the efficiency and effectiveness of behavioural interventions, but the technology just wasn’t yet smart enough in most cases to make these devices very successful. Technology has been so advanced now that we can make use of them to change the behaviour pattern of the consumer by providing user- friendly applications for energy awareness and conserving energy. Nowadays applications are created with a gamification theme to get the attention of the consumer and impact a change. 2.3.3 Energy Saving Becomes A Game Energy Life is a system utilising wireless sensors and a smartphone that turns energy consumers into active players. Energy Life participants play through different levels collecting scores in savings and through advice tip reading and quizzes. Key principles embodied in Energy Life are: situated and combined feedback including knowledge and consumption information, intuitiveness and non-intrusiveness by utilising an always at hand solution on a touch enabled smartphone, sustained interaction, and engagement by using an applied game that connects players within and between households. Householders do not always know how much energy they consume. To help improve their awareness, the EnergyLife app was developed through BeAware, an EU funded project, led by the Helsinki Institute for Information Technology (HIIT), in Finland. As part of the project, consumers in test groups had their home appliances fitted with wireless sensors. This enabled real-time information on power consumption to be delivered via the mobile app. What makes this app unique? It is designed like a game to entice the consumer to treat energy saving as a fun activity. By reading tips, completing quizzes and reducing their electricity usage they were able to collect scores and progress through higher levels in the game. “What we noticed with all lot of energy awareness programmes is that they have an impact for a limited time, but people lose interest over time,” explains Giulio Jacucci, the project coordinator and a professor of computer science at HIIT. “The idea of gamification is to maintain engagement by accompanying the consumer through a process whereby they learn something, achieve some goals and move on to the next level. If they are under-challenged, they will become bored
  • 12. 11 whereas if they are over-challenged, they become frustrated.” He believes the game provides a way of always keeping consumers engaged with the right amount of challenge. This approach leads to collaboration among players. “The gamification process introduces some interesting social mechanisms,” he adds, “The users compete for one against another initially. But after a while, they start to ask questions of each other, so it becomes cooperative in the way they share new information and knowledge.” Jacucci says that he intuitively believes the gaming aspects enhance the effectiveness of the app. However, because the study did not include a control group receiving the same advice through more conventional means, he acknowledges results are inconclusive. What the results nevertheless showed that when users were provided with personalised feedback, they achieved the greatest savings. This, Jacucci believes, is because it crystallised the link between specific behaviour – for example putting something very hot in the refrigerator – and experiencing a temporary setback in meeting goals, as part of the game. “Personalising the advice can really make a difference,” agrees Niamh McDonald, a buildings policy analyst at the Global Buildings Performance Network in Paris, France. She tells youris.com: “Not everyone is the same, and different households will have different needs, values and interests.” She also argues that because the user experience is designed to be positive, programmes like EnergyLife offer greater chances of success than campaigns setting out to make consumers feel guilty about damaging the environment. “If people take the time to get involved in a voluntary programme, it makes no sense to criticise them,” she says. “Rather than preaching, empowering them to make changes is definitely the way to go.” Many behavioural change programmes fail because it takes the time to achieve real results, according to Alec Dorling, manager of embedded software process organisation with the Volvo Group in Sweden. Referring to his own research on the role of gamification in software process improvement, he tells youris.com: “In game playing, the psychology is to provide a lot of points early on, enabling achievement of levels 1-2 very quickly. This provides fast feedback and creates engagement and motivation.” The key to making energy saving “fun”, Dorling believes, centres on carefully maintaining the balance between abilities and challenge. 2.3.4 EkoGuru – Social App For Energy Awareness Refresh is excited to be involved with EkoGuru.com which is the brainchild of gamification guru Wynand Goosen who has studied gamification design in San Francisco which lead to the development of the EkoGuru web app. EkoGuru aims to make saving energy a fun and easy habit, with the use of a social game aiming to change energy habits and reduce the reliance on dirty power.
  • 13. 12 Ekoguru makes being energy aware fun and easy. Rewarding energy efficiency while suggesting simple ways to decrease the consumption and your bills. Ekoguru has been designed to make what is normally a boring, slow process of trying to change energy use habits into a fun, social and engaging activity for the whole family. Gamification and Hook principles have been introduced in the app to ensure players remain engaged. Ekoguru audit player’s appliance data and recommend energy efficient alternatives to purchasing. Players compete and interact within their neighbourhoods, cities, states and nations. Players challenge each other through fun energy saving tasks and dares. Ekoguru is designed to generate big data related to energy use on a global scale, lead generation for solar installers, financial institutions providing credit for energy-related retail purchases and appliance manufacturers and distributors. Ekoguru is launching on Earth Hour day with further phases rolling out in April and May to include more aspects of sustainable living. Technology Profile Ekoguru  Wordpress CMS  Google Analytics  CSS (Cascading Style Sheets)  HTML (HyperText Markup Language)  Html5  Javascript  jQuery  jQueryUI  Php (Hypertext Preprocessor) 2.3.5 Green Shifting A mobile application for the efficient usage of renewable energy A mobile application is designed and implemented to inform an energy consumer about times with a high amount of renewable energy produced, so he or she shifts the usage of energy consumers to those times and thus use rather renewable energy than conventional. The application is implemented using a cross-platform development tool. To motivate users to actively use it, gamification elements are included. Its usability is evaluated with five test users. The result is Green Shifting, a cross-platform mobile application that encourages users to use the available renewable energy more efficiently. This is a system that supports users who are interested in improving their own renewable energy awareness. Everyone can easily shift the usage of some electronic devices like washing machines to time slots when there is a lot of renewable energy produced. They only need to know when these times are. Therefore, data about the produced energy needs to be requested from the providers and published in a way that as many people as possible can access and use it. It is the concept of the Green Shifting system to fulfill exactly these
  • 14. 13 requirements by collecting the energy data, processing it and presenting it to the end user. The publication is achieved via a mobile application that visualises the energy information. To reach as many users as possible this application needs to be available for the most common mobile platforms Figure 4.1 shows the different components of the system. The energy data is collected and processed by a server and then stored on a Firebase database. The application enables the interaction of the mobile devices with the database. To send push notifications, the server invokes an event on the system specific messaging servers which send the notification to the registered device. Table 4.1 shows the association of platforms and messaging servers. The database management system used in the Green Shifting system is Firebase. It is a powerful API to store and sync the data in real-time. Its libraries run on all major web and mobile platforms and can be extended using the REST API. Figure 2.1 2.3.6 Energy Awareness Programme for Schools – Programmes for children and teachers Tipperary Energy Agency has teamed up with the Sustainable Energy Authority of Ireland (SEAI) to deliver energy workshops to primary and secondary schools in Co Tipperary. The programmes, which are free of charge to the schools, provide a series of interactive, hands-on workshops for students. In primary schools, the programme is delivered from senior infants right up to sixth class and teaches children the science of energy and energy efficiency. At secondary school level, 1st and 2nd-year science students are
  • 15. 14 taught about the science of energy, using everyday materials based on simple scientific principles. Last year the programme visited 32 schools and met over 1400 children. SEAI are now also offering “Exploring Our Energy”, which is a whole school programme aimed at teachers in the primary school environment. As well as a range of supports for teachers to use the programme in class, an after-hours CPD workshop is also available to teachers.
  • 16. 15 2.4 Summary Project Title Summary Year Comments Pros & Cons Norwegian Industrial Energy Efficiency Network The programme was instrumental in identifying and implementing energy efficiency techniques and potential for energy efficiency in small and medium sized industries 1989 The Norway government set a target to be achieved by the industries through energy efficiency schemes which encourage the industries to implement such schemes Many Small and medium scale enterprises were encouraged to switch to renewable energy sources to meet the energy- saving target The NRGi smart meter roll-out programme Installing smart meters throughout the customer base with an objective to prepare their service network for future challenges 2009- 2012 With the smart meters the customers were able to view their energy consumption in mobile phones which acted as a feedback and in turn affected their energy consumption behaviour. Customers had an option for feedback from these smart meters via smartphone or the web. Customers were not much interested in these feedback options and it was difficult explaining to the customers why there is a need for new meters. Smart Meters in Sweden Smart meters were rolled out to the customer base and mandatory monthly reading was introduced. 2006 Customers can have hourly reading with these meters now which is good for a quick feedback option on the energy consumption A mandatory monthly meter reading encouraged the customers to review their energy consumption every month. The customers could also have hourly readings if they wish. Resistance to the new system and negative experiences like faulty automation, lacking user friendliness, etc.
  • 17. 16 Energy Life Energy Life is a system utilizing wireless sensors and a smartphone that turns energy consumers into active players. Energy Life participants play through different levels collecting scores in savings and through advice tip reading and quizzes 2012 Real-time energy consumption information was delivered to the mobile app in this project which helped the consumer to monitor their energy consumption behaviour in real time. Real-time energy consumption information was delivered to the users via a mobile app. It was developed as a game to entice users to treat it as a fun activity. Users achieved greater savings. EkoGuru – Social App For Energy Awareness Ekoguru audit player’s appliance data and recommend energy efficient alternatives to purchasing. Players compete and interact within their neighbourhoods, cities, states and nations. Players challenge each other through fun energy saving tasks and dares. 2015 Ekoguru makes awareness about energy consumption fun and encourages people to use less energy by innovative and effective ways of competing with others, dares, socialising, etc. EkoGuru suggests simple ways to reduce energy consumption. Gamification elements make the application fun to use. EkoGuru is a web application and hence requires an active internet connection to use it. Green Shifting A mobile application for the efficient usage of renewable energy A mobile application is designed and implemented to inform an energy consumer about times with a high amount of renewable energy produced, so he or she shifts the usage of energy consumers to those times and thus use rather renewable energy than conventional. 2015 The unique concept of informing the user the times when renewable energy resources are used will help consumers save a lot of energy by a much little reduction in energy consumption. It will have a larger impact with minute changes in user behaviour towards energy consumption. The application collects energy production information from the providers and presents it in a very user-friendly way. The data is sync real-time.
  • 18. 17 2.5 Conclusion Energy conservation can be effectively achieved only by combining the use of technology with consumer behaviour. Achieving a positive change in consumer behaviour with regards to energy use is a vital step towards energy conservation. Using technology applications with innovative and creative approaches will indulge the customers in using it and thus spread energy awareness is one way of achieving the technology behaviour combination. Tamagreen is an innovative web application to teach young scholars energy awareness and the impact that energy consumption has in the society where we live in. Inculcating an idea of saving energy in young minds is the best way to reduce energy use in the future.
  • 19. 18 Chapter 3: Analysis and Design This chapter explains the underlying Tamagreen System and the API developed for data extraction. A conceptual framework is described in the analysis section. The design section explains the general structure of the solution design that will be used to implement the analysis. Design section will also explain individual pages of the whole system in detail, the parameters of the entities that will exist in the system and also the API developed to extract data. Technologies Section will explain the infrastructural elements of the proposed system along with the development environment and the database. 3.1 System Overview Figure 3.1 The application is basically divided into three parts –  Rails Application  Java API  Wattics Rails Application This is a web application developed using Ruby on Rails. It basically comprises of the front-end of the application which the user interacts with.
  • 20. 19 Java API The Java API is a middleware for the web application to interact with the Wattics System. It uses RESTful API to achieve this. Wattics System Wattics provides smart meters which will be installed in the organization to get energy consumption data. This data is then retrieved using a JDBC connection to the Wattics database. 3.2 Analysis 3.2.1 Tamagreen Web Application The project includes developing an interactive Ruby on Rails web app to be displayed on a large screen at the entrance of the school that learns the consumption patterns of the school and the good or bad behavior of teachers and children. It will then display an entertaining and animated character that responds to the energy-efficient or wasteful behavior of individuals in the school. The app will develop Java functions to retrieve energy and expected energy data from an existing Wattics online energy analytics database (MySQL). It will then animate Tamagreen if the energy consumption goes below or above the expected energy at that time of the day. After the initial analysis of the application was complete , 6 core pages were identified that are essential for a system with only core functionalities.  Authentication Pages: 1. Login 2. Register  User Pages: 1. Welcome Page 2. Application Configuration 3. Edit User Info 4. Logging  Super User Page: 1. Admin Profile  Tamagreen display page 3.2.2 Tamagreen API A Java API will be developed to access the information from Wattics database. The API will give the expected energy consumption data based on the current temperature and the previous energy consumption. It will also get data about the current energy consumption to compare with the expected energy consumption and calculate the offset. The API will be used to implement following services:
  • 21. 20  Add user to database.  Update user in the database.  Get current electricity consumption  Get expected electricity consumption 3.3 Design 3.3.1 Tamagreen Web Application User Pages Welcome page will contain an introduction to the Tamagreen application with an image representing Green energy. Access to Login and Register pages will be through the links in this page. Login page will control the user authentication and it will ask for a username and password from the user. Access to Application configuration and Admin Profile page will be through the login page. There will be predefined users with super-user/ admin access. If login username is one of the superuser usernames then the page is redirected to Admin Profile Page. If a general user is logged in, he/she will be redirected to application configuration page. Register page will be used by new users of Tamagreen Web App. It will ask the prospective user for their username, password, meterid. Once the user registers, he/she will have to wait for the admin to review his details and approve him. Application Configuration page will enable the user to upload the images to be displayed based on the electricity consumption offset. The user will be asked to enter the nature of offset i.e. positive or negative. Positive offset means the current energy consumption is less than the previous energy consumption. Negative offset is when the current energy consumption is greater than the previous energy consumption. The user will also be asked to enter the offset value in percentage and select the image corresponding to this combination and click on save. A mock up for the above flow: Figure 3.2 The entry will be : Positive/Negative Offset > {Value}% and the corresponding image. The user can enter multiple combinations and set images for each combination. The image corresponding to the calculated combination will be used to trigger the application.
  • 22. 21 The Edit user info page and the Tamagreen application main page is accessed from this page. Edit User Info page will display the username and channel id for logged in user. The username is not editable. The user can edit password or channel id and click on save. After submitting the user will be able to log in only after the super user approves the new changes again. Tamagreen main page calculates the offset percentage from the expected value and current value of energy consumption and retrieves the corresponding image stored in SQLLite database at the client side. The page reloads every 5 seconds using an AJAX call. Logging is used to view the data of actual and expected energy consumption in numbers along with the offset percentage. This data can be used as a guide to set the images in the configuration page. Admin Page Admin Profile page displays the list of users that are currently registered to the Tamagreen Web Application with their current status on the application. The admin can approve new users registered or when changes are made to existing users. The Web Application framework is portrayed in the UML diagram – Figure 3.3 3.3.2 Tamagreen API In computer programming, an application programming interface (API) is a set of routines, protocols, and tools for building software and applications. An API expresses a software component in terms of its operations, inputs, outputs, and underlying types, defining functionalities that are independent of their respective implementations, which allows definitions and implementations to vary without compromising the interface. A good API makes it easier to develop a program by providing all the building blocks, which are then put together by the programmer. An API may be for a web-based system, operating system, or database system, and it provides facilities to develop applications for that system using a given programming language. TamagreenServiceAddUser This service will call the underlying addUser Java method to add the username and password to the MySQL database at the server side. The requested URL will contain the username and password. The password will be hashed using MD5. The user will be added to User table and User_roles table with role member. The addUser service can only be called using admin authentication i.e. a user with role admin. Admin users are predefined in the database at the server side with the same credentials as that used in the web application. The add user is called
  • 23. 22 when the Admin approves the newly registered user from the admin profile UI. The response XML contains the username and the hashed password. TamagreenServiceUpdateUser This service will call the underlying updateUser Java method of the API to update the password of the user corresponding to the username received in the MySQL database. The requested URL will contain the username and password. The password will be hashed using MD5. The password will be updated in the User table. The updateUser service can only be called using admin authentication i.e. user with role admin. Admin users are predefined in the database at the server side with the same credentials as that used in the web application. The updated user is called when the Admin approves the changes made to an existing user from the admin profile UI. The response XML contains the username and hashed password. TamagreenServicerawdata This service calls the underlying Java method of the API to get the current electricity consumption data from the Wattics database. When the user runs the Tamagreen main page, the service is invoked. The requested URL for the service contains the channel id and the timestamp. The method invoked by the service establishes a JDBC connection with Wattics database and queries the electricity_raw table with the channel id and the timestamp. The data corresponding to the timestamp that is nearest to the input timestamp is retrieved. Active power for each phase i.e. active_power_A, active_power_B, active_power_C is retrieved and their sum is stored in totalactivepower. These values are then sent back in the response XML. This service is invoked when the Tamagreen web application main page loads each time. The access to this service is for users with role member. Hence the service is invoked only when the user with role member is logged in. Basic HTTP Authentication is used. TamagreenServiceexpectedconsumtpion This service calls the underlying Java method of the API to get the expected energy consumption data calculated using the previous energy consumption data from Wattics database taking into account the temperature of the day using Simple Regression Model. The requested URL contains the channel id and timestamp. The energy consumption data for 7 days prior to the timestamp for each hour between 8 am to 4 pm is extracted from Wattics database. The temperature corresponding to this data is also extracted using WeatherUnderground API. The WeatherUnderground API gives the historical temperature for each hour of the day for the last 7 days from the timestamp between hours 8 am to 4 pm. Using the data for electricity consumption and the corresponding temperature a regression model is developed and the slope and intercept are calculated. Using the org apache math3 package which provides a Simple Regression class named -
  • 24. 23 org.apache.commons.math3.stat.regression.SimpleRegression, the regression model can be calculated. The current temperature corresponding to the timestamp in the request URL is extracted using WeatherUnderground API. Using the temperature and the slope and intercept from the regression model, the expected electricity consumption is calculated using slope-intercept formula. The expected electricity consumption is then sent in the response message. The Java API framework is described in the UML diagram – Figure 3.4
  • 25. 24 3.4 UML Diagram 3.4.1 Ruby Web App Figure 3.3
  • 27. 26 3.5 Use Case Diagram 3.5.1 Use Case for Student Figure 3.5 ID Use Case 1 Title Student viewing Tamagreen Website Description A student views the Tamagreen page that runs on the application Primary Actor Student Preconditions Tamagreen Page is displayed Postcondition The page refreshes by itself Success Scenario The displayed page reacts to the change in energy consumption
  • 28. 27 3.5.2 Use Case for School Staff Figure 3.6 ID Use Case 1 Title Configuring Application Description School Staff configures images to be displayed in the application Primary Actor School Staff Preconditions Logged in as a member Postcondition The images are uploaded to the application Success Scenario The page is displayed with the correct image ID Use Case 2 Title Login Description School Staff login to the application Primary Actor School Staff Preconditions Valid username and password Success Scenario User Logged in ID Use Case 3 Title Register Description School Staff registers as a member Primary Actor School Staff
  • 29. 28 Preconditions User must enter all the required details with unique username Success Scenario User is registered ID Use Case 4 Title Edit User Preference Description User can edit the account details Primary Actor School Staff Preconditions Logged in as School Staff Success Scenario The details are updated ID Use Case 5 Title Logging Description User can view the logs in the application Primary Actor School Staff Preconditions Logged in as School Staff Success Scenario The logs are displayed correctly ID Use Case 6 Title Logging Description User can view the logs in the application Primary Actor School Staff Preconditions Logged in as School Staff Success Scenario The logs are displayed correctly ID Use Case 7 Title Run application Description User runs the tamagreen application to display the images Primary Actor School Staff Preconditions Logged in as School Staff Success Scenario Images are displayed as per the energy consumption
  • 30. 29 3.5.3 Use Case Super Admin Figure 3.7 ID Use Case 1 Title Login Description Super admin logs into the application Primary Actor Super User Preconditions Valid username and password Success Scenario User logged in successfully ID Use Case 2 Title Approve new user Description Super admin approves newly registered users Primary Actor Super User Preconditions Logged in as Super User Success Scenario Users are approved and can access the application
  • 31. 30 3.6 Wattics High-Performance Power and Energy Meter Wattics Energy analytics is a comprehensive, web-based, energy management software platform that provides real-time energy data, projections of savings, IPMVP measurement and verification, tariff analysis, energy performance assessment, reporting and much more. The platform is the perfect tool for energy managers and business owners making intelligent business decisions to identify energy wastage, save money, increase sustainability and reduce carbon footprint. Wattics allows a full flexibility for customers to collect data from the building, and process directly from smart meters, sensors and other databases such as process control systems and building automation systems. The hosted service allows users to easily access real-time data on-line from any web-enabled computer. Wattics provided quality engineered energy Acuvim submeters provides a simple robust solution for power monitoring, power quality analysis, kWh metering, system integration, controlling power distribution systems & other specialty applications. Figure 3.8 Specification: Input Range 10A-200A Typical Input 100A, 200A Rated Option 333mV Window Size (in) 0.75 x 0.75 Window Size (mm) 19.1 x 19.1 Exterior Dimensions (in) 2 x 2.098 x 0.669 Exterior Dimensions (mm) 50.8 x 53.3 x 17
  • 32. 31 Some of the features of the meter include:  NEMA 3 industrial grade weather-resistant enclosure protecting it against rain, snow & dust while displaying a large three-line backlit LCD screen.  Optional field-swappable communications modules for BACnet, Modbus, DNP 3.0, Profibus and other protocols plus analog/digital I/O, alarms, & relays.  Optional DIN rail mount transducer form factor for system integration. The Acuvim II series offers these powerful metering options.  Data Logging Maintains a historical record of data for users to remotely monitor trends, analysis and reports with the capability to set threshold alarms in such applications as tenant and facility metering.  Time-Of-Use Segment your peak hour kilowatt hour (kWh) usage for industrial, commercial & tenant facilities by setting a time-based or tier-based rate structure.  Power Quality Monitoring Safeguard against system failures with harmonic analysis and advanced power quality event logging with waveform capture. The Tamagreen application makes use of the data logging feature of the Acuvim series meter. The data retrieved using the meter is stored in Wattics database from where the application access required data to run the application. 3.7 Technologies The following frameworks and libraries are a set of components that are widely used for Web applications. As it is not a rare subset of technologies and there are many people that are fluent in this kind of applications, it would be easier to find developers for improvements they might need on the system. The majority of the versions chosen are the latest versions of the given technologies and they are well-built suite for providing any required functionality. 3.7.1 Ruby on Rails Ruby is a dynamic, reflective, object-oriented, general-purpose programming language. It was designed and developed in the mid-1990s by Yukihiro Matsumoto in Japan. Ruby is thoroughly object-oriented with inheritance, mixins Accuracy 0.50% Standard/Certifications UR, CE, RoHS Weight 0.2 lbs Form Factor Square Split Core CT
  • 33. 32 and metaclasses. Ruby 2.0.0 is used in this project but it is upgradable to the latest version. Ruby on Rails, or simply Rails, is a web application framework written in Ruby under MIT License. Rails is a model–view–controller (MVC) framework, providing default structures for a database, a web service, and web pages. It encourages and facilitates the use of web standards such as JSON or XML for data transfer, and HTML, CSS and JavaScript for display and user interfacing. The latest stable version of rails, 4.2.5 will be used in this project which was first released on October 30, 2015. 3.7.2 MVC Framework Model–view–controller (MVC) is a software architectural pattern mostly (but not exclusively) for implementing user interfaces on computers. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user. Traditionally used for desktop graphical user interfaces (GUIs), this architecture has become extremely popular for designing web applications. Components The central component of MVC, the model, captures the behavior of the application in terms of its problem domain, independent of the user interface.  A Model , which represents the underlying, logical structure of data in a software application and the high-level class associated with it. This object model does not contain any information about the user interface.  A view can be any output representation of information, such as a chart or a diagram. Multiple views of the same information are possible, such as a bar chart for management and a tabular view for accountants.  The third part, the controller, accepts input and converts it to commands for the model or view. It represents the classes connecting the model and the view and is used to communicate between classes in the model and view. Interactions In addition to dividing the application into three kinds of components, the model–view–controller design defines the interactions between them.  A model stores data that is retrieved according to commands from the controller and displayed in the view.  A view generates an output presentation to the user based on changes in the model.
  • 34. 33  A controller can send commands to the model to update the model's state (e.g. editing a document). It can also send commands to its associated view to change the view's presentation of the model (e.g. by scrolling through a document). 3.7.3 Java Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere", meaning that compiled Java code can run on all platforms that support Java without the need for recompilation. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture. As of 2016, Java is one of the most popular programming languages in use, particularly for client-server web applications. The latest version of Java, 1.8, will be used in this project which was first released on March 18, 2014. 3.7.4 Apache Software Foundation Apache Software Foundation (ASF) is an organization funded by donations and sponsors. There are currently more than 350 Open Source projects overseen by the ASF that is developed and maintained by volunteers all over the world. An individual is awarded membership after they are nominated for it and the majority of the ASF members approve this nomination. The ASF members periodically elect Board of Directors which govern organizational affairs and the operations of ASF. The Apache Software Foundation is a decentralized community of developers. The software they produce is distributed under the terms of the Apache License and is free and open source software (FOSS). The Apache projects are characterized by a collaborative, consensus-based development process and an open and pragmatic software license. Each project is managed by a self-selected team of technical experts who are active contributors to the project. The ASF is a meritocracy, implying that membership of the foundation is granted only to volunteers who have actively contributed to Apache projects. The ASF is considered a second-generation open-source organization, in that commercial support, is provided without the risk of platform lock-in. Tomcat Apache Tomcat, often referred to as Tomcat, is an open-source web server developed by the Apache Software Foundation (ASF). Tomcat implements several Java EE specifications including Java Servlet, JavaServer Pages (JSP), Java EL, and WebSocket, and provides a "pure Java" HTTP web server environment for Java code to run in. Tomcat version 8.0 is being used in the project.
  • 35. 34 Catalina is Tomcat's servlet container. Catalina implements Sun Microsystems' specifications for servlet and JavaServer Pages (JSP). In Tomcat, a Realm element represents a "database" of usernames, passwords, and roles (similar to Unix groups) assigned to those users. Different implementations of Realm allow Catalina to be integrated into environments where such authentication information is already being created and maintained, and then use that information to implement Container Managed Security as described in the Servlet Specification. Commons Apache Commons is a large project focused on producing reusable Java components on all aspects of Java. One of the Commons’ goal is to provide stable and independent components so developers wouldn’t need to worry about changes in the future. The Commons project is composed of three main parts that provide over 70 components. The math component of the commons project is included in the application to develop a regression model between energy consumption and temperature. 3.7.5 RESTful API RESTful Web Services are REST architecture based web services. In REST Architecture everything is a resource. RESTful web services are lightweight, highly scalable and maintainable and are very commonly used to create APIs for web based applications. REST stands for Representational State Transfer. REST is web standards based architecture and uses HTTP Protocol for data communication. It revolves around resource where every component is a resource and a resource is accessed by a common interface using HTTP standard methods. REST was first introduced by Roy Fielding in 2000. In REST architecture, a REST Server simply provides access to resources and REST client accesses and presents the resources. Here each resource is identified by URIs/ global IDs. REST uses various representations to represent a resource like text, JSON and XML. Nowadays JSON is the most popular format being used in web services. HTTP Methods Following well-known HTTP methods are commonly used in REST based architecture.  GET - Provides a read-only access to a resource.  PUT - Used to create a new resource.  DELETE - Used to remove a resource.  POST - Used to update an existing resource or create a new resource.
  • 36. 35  OPTIONS - Used to get the supported operations on a resource. RESTFul Web Services A web service is a collection of open protocols and standards used for exchanging data between applications or systems. Software applications written in various programming languages and running on various platforms can use web services to exchange data over computer networks like the Internet in a manner similar to inter-process communication on a single computer. This interoperability (e.g., between Java and Python, or Windows and Linux applications) is due to the use of open standards. Web services based on REST Architecture are known as RESTful web services. These web services use HTTP methods to implement the concept of REST architecture. A RESTful web service usually defines a URI, Uniform Resource Identifier a service, provides resource representation such as JSON and set of HTTP Methods. JAX-RS stands for JAVA API for RESTful Web Services. JAX-RS is a JAVA based programming language API and specification to provide support for created RESTful Webservices. Its 2.0 version was released on 24 May 2013. JAX-RS makes heavy use of annotations available from Java SE 5 to simplify development of JAVA based web services creation and deployment. It also provides supports for creating clients for RESTful web services. Jersey, a reference implementation of JAX-RS 2.0 by Oracle, in RESTful Web Services is implemented in the project. 3.7.6 HTML & AJAX HTML is a markup language for describing web documents (web pages).  HTML stands for Hyper Text Markup Language  A markup language is a set of markup tags  HTML documents are described by HTML tags  Each HTML tag describes different document content AJAX is a web development technique for creating interactive web applications. 3.7.7 MySQL MySQL is a highly popular Open Source relational database management system which will be the backing database of the system. Wattics has a MySQL database which will be queried using the API to get data.
  • 37. 36 MySQL is a popular choice of database for use in web applications and is a central component of the widely used LAMP open source web application software stack (and other "AMP" stacks). LAMP is an acronym for "Linux, Apache, MySQL, Perl/PHP/Python". Free-software open-source projects that require a full- featured database management system often use MySQL. 3.7.8 Development Environment The web application in Ruby on Rails will be developed using JetBrains RubyMines IDE. The API will be built in a Java Development Environment in Eclipse.
  • 38. 37 Chapter 4: Implementation The application has been implemented with collaboration with Wattics. The project has following main components: 1. Tamagreen Web application developed on Ruby on Rails 2. SQLLite DB in the web application 3. Tamagreen API developed in Java using Eclipse IDE 4. MySql DB at the server end 5. Wattics Database 4.1Tamagreen Web Application The web application is developed using ruby on rails. It can be accessed using the URL – www.tamagreen.wattics.com. It has following web pages included. 4.1.1 Homepage The homepage or welcome page describes the application. It gives a basic idea of what the web application is about. A carousel of relevant images is implemented. Figure 4.1 The page has 3 buttons to navigate. Login, Register and How to use. A bootstrap feature called carousel is used to navigate through the various images in the welcome page. The images give a brief idea about the application. <div class="carousel slide" id = "featured" data-ride="carousel" style="padding- bottom:0px;">
  • 39. 38 4.1.2 Login Page The login page enables the user to login to the application. There are validations on this page such as user id and password are required fields. The username and password must be correct or else an invalid details message is thrown. Figure 4.2 The page checks if the logged in user is an admin and if it is, the user is navigated to the administrative page or else the user is navigated to the configuration page. The back button will take you back to the homepage. 4.1.3 Register The register page enables one to register a new user. All the fields in the register page are required to be filled to complete the registration process. Users cannot use an already registered user id twice. Once the registration is successful, the user needs to wait for an approval mail from the tamagreen team to proceed further. The details from the registration form are stored in the User table in SQLLite DB. The register controller calls the create method of the active record class to create a new entry in the user table. @user = User.create(:username => @username.strip.downcase, :password => @pwd, :channel_id => @channelid, :status => "Pen", :emailid => params[:emailid][0]) The record is inserted with pending status.
  • 40. 39 Figure 4.3 The back button will redirect the user to the homepage. The password is hashed before being stored in the database using the MD5 hash algorithm. This is a one-way hash and not even the admin can retrieve the password from the hash value stored in the database. This has been implemented for additional security. 4.1.4 How to use How to use page gives the user guidelines for using the application. The guidelines are provided in steps which are well structured and along with images to explain them. A new user can go through this page once to get an idea of how the application works and how to use it.
  • 41. 40 Figure 4.4 The images in this page can be clicked which will then open a modal window with the images. This is a nice feature to have a closer look at the images. This is also implemented using bootstrap. <div class="modal" role = "dialog" aria-labelledby="modalLabel" id="userpref" > <div class="modal-dialog" role = "document"> <div class="modal-content"> <div class="modal-body"> <img class = "img-responsive centre-block img-rounded" border="0" width="602" height="294" src="/assets/userpref.png"/> </div> <div class="modal-footer"> <button type = "button" class = "btn btn-default" data-dismiss = "modal"> Close </button> </div> </div> </div> </div> The back button will bring the user back to the homepage. 4.1.5 Configure Page This is the page where the user configures the images for the corresponding energy consumption values which will help the application to run. The user will enter the criteria and upload images corresponding to the criteria. The user can view the images uploaded by clicking on them. The navigation buttons on the page include, User preference Logging Logout Run Tamagreen
  • 42. 41 Figure 4.5 The records inserted on this page are stored in Entry table in SQL Lite database. For each entry corresponding image is stored in the assets folder in the application. The image is given a unique name to identify itself for a specific record. The images are clickable which will open up a modal window. On clicking on the delete button, the record from the database is deleted and also the image file in the assets folder. Entry.destroy(id) path = 'appassetsimages'+@entry.image_path if File.exist?(path) then File.delete(path) end 4.1.6 User Preference This Page allows the user to make changes to the user details like password, meter-id, email address. The page has validations on the text fields.
  • 43. 42 Figure 4.6 The changes made are updated in the database in the user table. @user.update_attributes({:password => @pwd, :channel_id => @channelid,:emailid => @emailid}) If the password is changed it is also updated in the Java API which has a MySQL database using update user API service. doc = Nokogiri::XML(open("http://localhost:8080/TamagreenAPI/rest/TamagreenService/updateuser"+" /"+@user.username.to_s+"/"+@pwd.to_s, :http_basic_authentication => [@admin.username, @admin.password])) Nokogiri is used to open the URL. A basic HTTP authentication is implemented in the URL which requires user authentication with admin role. This is further discussed in the API implementation section. 4.1.7 Logging The logging page enables the user to view the previous log and set the images accordingly. The page shows the energy consumed and the expected energy
  • 44. 43 consumption of a particular time which can be referred to while configuring the application. Figure 4.7 The logs are stored in logs folder. Each user will have a unique log folder associated with him. On every user login, the application will check if there is a log file for that user if it is not the application will fetch the data from the API and store it in the log file. At a particular time, a maximum of only 10 rows is logged for a particular user. begin otherfunc = ::Function.new path = "appassetslogs"+@username.strip.downcase+".log" if @user != nil && !File.file?(path) then currelecon = otherfunc.getenergyconsumption(timestamp,@user.channel_id,@user.username,@user.password) meanelecon = otherfunc.getexpectedconsumption(timestamp,@user.channel_id,@user.username,@user.password) if meanelecon == 0 then @path = "" else otherfunc.calculateperc(meanelecon,currelecon) otherfunc.getimage(@username) File.open('appassetslogs'+@username.strip.downcase+'.log', "a") {|f| f.puts(currelecon.to_s + "," + meanelecon.to_s + "," + otherfunc.perc.to_s) } if otherfunc.entry != "" then @path = otherfunc.entry.image_path else @path = "" end end end rescue => ex File.open('appassetslogs'+@user.username+'.log', "a") {|f| f.puts('0' + "," + '0' + "," + '0') } end
  • 45. 44 4.1.8 Tamagreen The run Tamagreen button runs the application and displays images that are configured as per the energy consumption of the organisation. The images to be displayed are displayed by calculating the offset percentage of the actual energy consumption from the expected energy consumption. Nokogiri is used to fetch these data from the Java API. #Get actual energy consumption from the server def getenergyconsumption(timestamp,channelid,username,password) doc = Nokogiri::XML(open("http://localhost:8080/TamagreenAPI/rest/TamagreenService/rawdata"+"/"+t imestamp+"/"+channelid.to_s, :http_basic_authentication => [username, password])) p doc elems = doc.xpath("//totalactivepower") return elems[0].text.to_i end #Get expected energy consumption from the server def getexpectedconsumption(timestamp,channelid,username,password) doc = Nokogiri::XML(open("http://localhost:8080/TamagreenAPI/rest/TamagreenService/expectedconsu mption/"+timestamp+"/"+channelid.to_s, :http_basic_authentication => [username, password])) p doc elems = doc.xpath("//expectedconsumption") return elems[0].text.to_i end The API calls are made with basic HTTP authentication with the user's username and password which is already present in the MySQL(API) database. You can use the configure button to go back. The page is refreshed automatically after every 5 seconds as specified. <meta http-equiv="refresh" content="5" /> An organisation can use any type of image which seems fit for the end users. For kids, in this case, gif images of a monkey character are being used.
  • 46. 45 Figure 4.8 4.1.9 User Admin Login The user admin login page gives details about the registered users and also enables the super admin to approve or delete any user. When the admin approves a new user, the user details are also sent to the Java API to be stored in the MySQL database. doc = Nokogiri::XML(open("http://localhost:8080/TamagreenAPI/rest/TamagreenService/adduser"+"/"+ @user.username.to_s+"/"+@user.password.to_s, :http_basic_authentication => [@admin.username, @admin.password])) These details are then used when getting data from the API to run the application The approved user is notified by email of the approve action. The ruby gem used to implement the mailing functionality is ActionMailer. It sends emails from the mail server using SMTP protocol. require 'action_mailer' #Setting up the SMTP settings for email ActionMailer::Base.smtp_settings = { :address => 'smtp.gmail.com', :port => 25, :domain => 'gmail.com', :user_name => 'tamagreen.wattics@gmail.com',
  • 47. 46 :password => 'akhil343', :authentication => :plain } class SendMail < ActionMailer::Base #sends email to the user #formele is an object of FormElement with page level element attributes def sendMailToUser(user) mail(:from => 'DONOTREPLY@tamagreen.com', :to => user.emailid, :subject => 'Tamagreen Account Activation', :body => "Hi "+user.username+",nn Welcome to Tamagreen. Your account has been activated. Please login at www.tamagreen.wattics.com/login/login to continue. nnn Regards,nTamagreen Team") end end Additional Note: The entire application is responsive and is developed using Bootstrap. The forms and buttons used have bootstrap styles. Bootstrap is the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites. Every text box uses a placeholder to make it easier to understand what detail the textbox is expecting. The tables used in the application are also responsive and interactive. Modal windows have been used in the application in multiple places. 4.2 SQLLite Database in the web application The application uses the sqlLite database in the rails application to store user records. User details like user id, password, email address, metered are stored in the application. Also the images and their path, the log files are also stored in the application and the metadata regarding these files are stored in sqlLite DB. Ruby gem used to implement this functionality is the ActiveRecord. Database schema: create_table "entries", force: :cascade do |t| t.string "level", limit: 255 t.integer "value" t.string "compare", limit: 255 t.string "image_path", limit: 255 t.string "channel_id", limit: 255 t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "userid" end create_table "users", force: :cascade do |t| t.string "username", limit: 255 t.string "password", limit: 255 t.string "channel_id", limit: 255
  • 48. 47 t.string "status", limit: 255 t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "emailid" end 4.3 Tamagreen API developed in Java There are four services developed in Java. 4.3.1 Get Energy Consumption URL: http://localhost:8080/TamagreenAPI/rest/TamagreenService/rawdata/{ datetime}/{meterid} The URL will get the current energy consumption of the organisation from Wattics database. The URL will basically hit TamagreenAPI service which accesses the electricity_raw table in the Wattics database which contains the data for the organisation's energy consumption. The data is stored in three columns – active_powerA, active_powerB, active_powerC which represents the three phases. The connection to Wattics database is obtained using JDBC connection. The data is obtained using the timestamp passed in the URL. The values closest to the timestamp is retrieved and sent in an XML response message which is then read in the ruby application using ruby gem Nokogiri. GET method of the RESTful service is used in this case. @GET @Path("/rawdata/{timestamp}/{channelid}") @Produces(MediaType.APPLICATION_XML) public RawData extractRawData(@PathParam("timestamp") String timestamp, @PathParam("channelid") int channelid) throws SQLException{ return TamagreenLib.extractRawdata(timestamp,channelid); }
  • 49. 48 4.3.2 Get Expected Energy Consumption URL: http://localhost:8080/TamagreenAPI/rest/TamagreenService/expectedco nsumption/{datetime}/{meterid} This URL hits the API service which calculates the expected consumption of the organisation at the timestamp provide and sends the data back. The function first retrieves the consumption data for the previous 7 working days between 8 am to 2 pm(the working hours of the school). try { date = formatter.parse(datetime.substring(0, 10)); cal.setTime(date); while (index < 8) { dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); if(dayOfWeek != 1 && dayOfWeek != 7){ if(index ==0){ result = getDataFromDB(datetime.substring(0, 10),channelid); }else{ result = appendArray(result,getDataFromDB(datetime,channelid)); } index += 1; } cal.add(Calendar.DATE, -1); date = cal.getTime(); } } It then retrieves the outside temperature for each hour in these 7 days using WeatherUndergroundAPI. public double getHourlyWeather(String date,String hour) throws Exception{ double temp = 0.0; TemperatureData td = new TemperatureData(); //hour = hour + ":00"; td = td.getTempDataFromDB(date,hour+":00"); if(td.isDataAvailable()){ return td.getTempValue(); }else{ DocumentBuilderFactory objDocumentBuilderFactory = null; DocumentBuilder objDocumentBuilder = null; Document doc = null; Element ele = null; String path = "http://api.wunderground.com/api/497fcd91a89840b0/history_" + date + "/q/Ireland/Dublin.xml"; InputStream stream = getWeatherFromAPI(path); try {
  • 50. 49 objDocumentBuilderFactory = DocumentBuilderFactory.newInstance(); objDocumentBuilder = objDocumentBuilderFactory.newDocumentBuilder(); doc = objDocumentBuilder.parse(stream); NodeList descNodes = doc.getElementsByTagName("hour"); for(int k = 8; k<=16; k++) { String hourCount = String.format("%02d", k); //hour = hour + ":00"; for(int i=0; i<descNodes.getLength();i++) { if(descNodes.item(i).getTextContent().equalsIgnoreCase(hourCount)){ ele = (Element) descNodes.item(i).getParentNode().getParentNode(); Double tempHour = Double.parseDouble(ele.getElementsByTagName("tempm").item(0).getTextContent()); td.addTempDataToDB(date,hourCount+ ":00",String.valueOf(tempHour)); if(hour.equals(hourCount)) { temp = tempHour; } break; } } } } catch (Exception ex) { throw ex; } return temp; } } It then uses simple regression with the data and calculates the expected energy consumption on the timestamp with the current outside temperature. public double CalcExpConsumption(double[][] data, double temp) { SimpleRegression regression = new SimpleRegression(); regression.addData(data); return regression.getSlope()*temp + regression.getIntercept(); } The org.apache.commons.math3.stat.regression.SimpleRegression is used to calculate simple regression This data is then sent back to the rails application in an XML format which is then read using Nokiogiri.
  • 51. 50 4.3.3 Add User URL: http://localhost:8080/TamagreenAPI/rest/TamagreenService/adduser/{u sername}/{password} This URL is used to add a newly registered user details to the MySQL database. The user is added in role member. The two tables are Tomcat_users Tomcat_user_roles 4.3.4 Update User URL: http://localhost:8080/TamagreenAPI/rest/TamagreenService/updateuser /{username}/{password} This URL is triggered when an existing user password is updated. It updates the user password in Tomcat_users table. Additional Note: RESTFul web services are used to create the API. javax.ws.rs package in java is used. All the API URLs are authenticated using Basic HTTP Authentication. Security constraints are added in web.xml to achieve this. <security-constraint> <web-resource-collection> <web-resource-name>TamagreenService</web-resource-name> <url-pattern>/rest/TamagreenService/*</url-pattern> <http-method>GET</http-method> <http-method>GET</http-method> </web-resource-collection> <auth-constraint> <role-name>member</role-name> </auth-constraint> </security-constraint> The URL for energy consumption require user authentication with role member where the URL for user details requires user authentication with role admin. To
  • 52. 51 achieve the authentication to target the Tomcat_users table in MySQL database, a JDBC realm is created in server.xml. <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.JDBCRealm" driverName="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://{servername}/tomcat_realm" connectionName="{conn_username}" connectionPassword="****" userTable="tomcat_users" userNameCol="user_name" userCredCol="password" userRoleTable="tomcat_users_roles" roleNameCol="role_name" /> </Realm> 4.4 MySQL DB at the server MySQL database is used in the API server in java to cache the temperature data which is retrieved once so that repeated calls need not be made to the WeatherUnderground API which is a third part API. This will increase the speed and efficiency of the application. Only requests for any temperature data which is not already present in the database will be made. The data is saved in temperature_data table. 4.5 Wattics database Wattics has a MySQL database deployed in amazon which is accessed using the JDBC connection from the API server. The API server only has read access to the database which will prevent from any changes being made to the database. All the connections to the database are immediately closed after making any query request so that it is memory efficient.
  • 53. 52 Apache Server The rails application is deployed on an apache web server. It is distributed under an “open source” license. A Web server is a software program that maps URL requests from a Web client to a resource that will handle the request and return a response to the client. The Web client and the Web server use HTTP to communicate over a TCP network. Apache server is run on a Linux machine launched in AWS. Putty is being used to connect to the Linux machine to activate the server. Tomcat Server Tomcat server is used to deploy the API services. This is again run on the same Linux machine. Weather Underground API WeatherUnderground is a third party API being used to get the temperature data. I have registered myself on the weather underground website and use their URL to get the data URL: To get the weather forecast for today: http://api.wunderground.com/api/497fcd91a89840b0/geolookup/conditions/f orecast/q/Ireland/Dublin.xml To get the weather history data http://api.wunderground.com/api/497fcd91a89840b0/history_{date}/q/Irelan d/Dublin.xml
  • 54. 53 Chapter 5: Evaluation 5.1 Software Evaluation Software evaluation was performed based on the various software used in developing the application. The application is implemented in two parts –  Ruby rails web application  Java API  Wattics Meter Ruby rails web application The web application is implemented using Ruby version 2.0.0 and rails version 4.2.5. The application implements the MVC architecture provided by rails which provide the object-oriented features like abstraction, inheritance, reusability, etc. The Rails web application runs on an apache web server that processes requests via HTTP. The application can run on any web browser and has no special requirements or plug-ins that need to be installed. The login and register functionality of the application is efficient requiring unique user id for every registration. The browser URL shows the logged in user Id but on changing the user id in the browser, it is redirected to the login page. The user sessions are handled to identify the user that is logged in thus avoiding unauthorized access. Multiple users can access the application from a different browser at the same time. Java API To implement the API java version 1.8 is being used. The API is deployed using tomcat web server. The RESTful services implemented uses HTTP methods to communicate with the application. HTTP downloads each file over an independent connection and then closes the connection. This reduces the risk of interception during transmission, as the connection does not persist beyond the transfer of a single element of a Web page. Hypertext Transfer Protocol Secure (HTTPS) encrypts the HTTP exchange to add further security. The server can handle multiple requests at a time. The system is not currently implemented to handle a high amount of requests since it is implemented for a single school, but a queuing of the requests can be implemented later on to increase the efficiency of the application.
  • 55. 54 The API is authenticated using basic HTTP authentication which secures it from unauthorized access. Wattics Meter The Wattics meter is active 24/7 and transmits real-time energy consumption information to the Wattics server which is then stored in Wattics database. The meter requires an active internet connection to work. 5.2 Application Evaluation The evaluation of the web application is based on a short survey completed by a group of 25 individuals including school students, college students, and corporate professionals. The group was given the link to the application and asked to go through it without giving any prior knowledge of what the application was about. The survey provided very positive feedback on the application from the group. Every individual among the group agreed that they feel the application is a very positive approach towards reducing energy consumption and encouraging green energy. None among the group found any difficulty in understanding the purpose or the usage of the application. In fact, 45.83% termed the application as very easy to use and the rest 54.17% termed it as easy to use. Refer Figure 5.1. Figure 5.1 Is the application easy to understand and use? Very Easy Easy Difficult Did not understand
  • 56. 55 The application has been developed for encouraging young kids to develop an awareness of energy conservation among young kids. From a rating of 1 to 5(5 being most likely) of the effectiveness of this concept, 47.83% gave it the maximum rating of 5, 43.48% agreed on 4 whereas 8.70% gave it a rating of 3. This shows that the general conception of the effectiveness of the web application is quite positive. Refer Figure 5.2. Figure 5.2 The application will be using images or gifs to get young minds to be encouraged about saving energy based on the motions shown in the images. This is a different approach that will connect with the kids better rather than showing any figures. These images can be any cartoon character like a monkey. 58.33% of the survey group gave a rating of 5(from 1-5, 5 being most likely) to the effectiveness of this approach, 33.33% gave a rating of 4 and 8.33% gave a rating of 3. Refer Figure 5.3. Figure 5.3
  • 57. 56 An important aspect to achieve effective energy consumption is to bring about a change in the consumption behaviour of the users. Everyone in the test group agreed that the application will bring a change in the users’ consumption behaviour which will be beneficial for reducing energy consumption. From the individuals that took the survey, 37.50% termed the application as Innovative, another 37.50% termed it as Effective and 25% termed it as Easy to use and understand. From the results, it seems the general conception about the application is a combination of all the three factors since all the three got almost equal votes. Refer Figure 5.4. Figure 5.4 Finally, when asked how likely will the application is to be suggested in an organisation by the individual, 50% gave it a rating of 5(from 1-5, 5 being most likely), 33.3% gave it a rating of 4 and 16.67% gave it a rating of 3. Refer Figure 5.5.
  • 58. 57 Figure 5.5 The survey suggested that the application has a good scope to be popular and be customized and used in various organisations to make the user energy aware by giving appropriate feedback and thus affect their energy consumption behaviour.
  • 59. 58 Chapter 6: Future Work The application is developed for young kids to develop energy awareness among them. It aims to affect the energy consumption behaviour of young kids. The application is currently developed for only a single school. But the application is scalable enough to accommodate multiple institutions by just increasing the database memory. Multiple schools can then collaborate with each other to encourage students to compete with each other and achieve a reduction in energy use. The application can be incorporate features to enable comparing the consumption data between two or more institutions in a graphical and interactive way like the app itself. This concept can be further customized to target a larger audience in other organisations as well. The application can target adult users which will, in turn, have a greater impact on energy conservation. The application can also be implemented at a national level at various institutions and organisations which can help reach the EU target of 20% energy efficiency by 2020. As per EU directive, energy distributors or retail energy sales companies have to achieve 1.5% energy savings per year through the implementation of energy efficiency measures. The application can be incorporated as one such energy efficiency measure.
  • 60. 59 Chapter 7: Conclusion Energy conservation is the need for the day. The application tries to bring about a positive change in the behaviour of energy users. The application target young kids. The application has an effective and technological approach by connecting with the kids using cartoon images and graphics. The application gives a visual feedback on the basis of the energy consumption data in your organisation. It uses images the user have configured to give a visual feedback on the offset between the actual energy consumed by the organisation and the expected energy consumption based on past data keeping in account the outside temperature. The application uses smart meters provided by Wattics to read the energy consumption of your organisation. The application explores various technologies like Ruby rails, Java, MySQL. It implements a Java API using RESTFul services and also makes use of third party APIs to get temperature data. The web pages are implemented using bootstrap which makes it responsive and interactive. Young children are the future of our generation. Influencing them to be aware of the energy consumed in their surroundings like schools, homes, etc. is a good approach towards future energy conservation. The evaluation performed on the application provides very positive feedback from the users who used the application. It has a very good potential to make a positive impact in the energy consumption behaviours of the users. As per the evaluation results, the application has scope to develop further and be implemented on a larger scale. The 2012 Energy Efficiency Directive establishes a set of binding measures to help the EU reach its 20% energy efficiency target by 2020. Under the Directive, all EU countries are required to use energy more efficiently at all stages of the energy chain from its production to its final consumption. Tamagreen application and other such energy efficiency measures can help the EU nations achieve their target.
  • 61. 60 Chapter 8: References  Tippenergyie. (2015). Tipperary Energy Agency. Retrieved 27 June, 2016, from http://tippenergy.ie/energy-awareness-programme-for-schools-programmes-for- children-and-teachers/  Youriscom. (2016). Youriscom. Retrieved 27 June, 2016, from http://www.youris.com/Society/Daily_Life/When_Energy-Saving_Becomes_A_Game.kl  Githubio. (2016). Githubio. Retrieved 3 June, 2016, from http://eis- bonn.github.io/Theses/2015/Theresa_Otte/thesis.pdf  Energyawarenesseu. (2016). Energyawarenesseu. Retrieved 27 June, 2016, from http://www.energyawareness.eu/beaware/uploads/BeAware_leaflet.pdf  Europaeu. (2016). Europaeu. Retrieved 23 June, 2016, from http://ec.europa.eu/research/energy/eu/index_en.cfm?pg=policy  Europaeu. (2016). Europaeu. Retrieved 29 June, 2016, from http://www.eea.europa.eu/publications/achieving-energy-efficiency-through- behaviour/download  Arrowditie. (2016). Arrowditie. Retrieved 20 June, 2016, from http://arrow.dit.ie/cgi/viewcontent.cgi?article=1138  Stanfordedu. (2016). Stanfordedu. Retrieved 27 June, 2016, from http://web.stanford.edu/class/me221/readings/Persuasive_Tech_Sustainable_Behavior .pdf Technical Software References  Rubyonrailsorg. (2016). Rubyonrailsorg. Retrieved 14 June, 2016, from http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html  Tutorialspointcom. (2016). Wwwtutorialspointcom. Retrieved 24 June, 2016, from http://www.tutorialspoint.com/restful/  Instructablescom. (2016). Instructablescom. Retrieved 26 June, 2016, from http://www.instructables.com/id/Implement-Your-Own-API-in-Java-Using- Eclipse/step5/Add-JAR-to-Build-Path/  Oraclecom. (2016). Oraclecom. Retrieved 14 July, 2016, from http://docs.oracle.com/javase/tutorial/jdbc/overview/index.html  Rubygemsorg. (2016). Rubygemsorg. Retrieved 14 July, 2016, from http://guides.rubygems.org/command-reference/  Theopentutorialscom. (2016). Theopentutorialscom. Retrieved 29 June, 2016, from http://theopentutorials.com/examples/java-ee/jax-ws/create-and-consume-web- service-using-jax-ws/  Crunchifycom. (2012). Crunchify. Retrieved 09 July, 2016, from http://crunchify.com/how-to-build-restful-service-with-java-using-jax-rs-and-jersey/  Avajavacom. (2016). Avajavacom. Retrieved 13 July, 2016, from http://www.avajava.com/tutorials/lessons/how-do-i-use-form-authentication-with- tomcat.html  Avajavacom. (2016). Avajavacom. Retrieved 22 July, 2016, from http://www.avajava.com/tutorials/lessons/how-do-i-use-a-jdbc-realm-with-tomcat-and- mysql.html?page=2