FIT5046 Mobile and Distributed Computing Systems
Practical Assignment Phase 2 – 2018 (Semester 1)
The assignment is an individual assignment.
The assignment has a total of 100 marks (it is worth 30% of the unit’s final mark).
Due Dates Interviews:
The submission is due on Monday Week 9 (30th of April) by 3pm.
Demos/interviews will be held in the Tutorials in Week 10 and 11 (you should book a time with
your tutor). Without an interview, the assignment mark will be zero.
SmartER (Smart Energy Recommender): An Overview
In Phase 1, you created the backend of the system as RESTful web services (including a database) to
enable querying the electricity usage data and updating it. The RESTful web service provides services
such as registering new residents, and storing and querying electricity usage data.
In Phase 2 (this assignment), you will implement an Android application. The Android application
will be the mobile client and consume the RESTful Web Service that you developed in Phase 1 in
NetBeans. It will also invoke other public web APIs.
The mobile app assists Victorian residents (energy consumers) with better energy management by
providing related information, and enabling them to view their energy consumption reports. If the
usage is high during peak hours, it will provide the user with a warning message. Alternatively, when
the usage value is low, the user will receive an encouraging message to continue saving. The
historical data usage can be viewed on an hourly or daily basis using different types of graphs on the
mobile app.
Task 1: Invoking public web APIs (10 marks):
A weather API will be used to provide the weather information (i.e. temperature) for a location. You
need to call the right API methods and pass the right parameters, and then parse the JSON response to
retrieve the current temperature. (10 marks)
The current temperature value will be displayed in the home page of the Android app (Task 6), and
also stored hourly in the electricity usage table (Task 3).
These are some examples of weather APIs below, but you can find and use any other weather API.
Make sure you use the free access.
Open Weather Map http://www.openweathermap.org/api
World Weather Online’s weather http://developer.worldweatheronline.com/api/
Dark Sky API https://darksky.net/dev/
Task 2 Electricity usage simulator (10 marks):
a) You need to create a class that continuously generates random electricity usage value for THREE
appliances per hour. The random values should be close to real values (refer to Phase 1
specifications). (3 marks)
These usage values along with the temperature value (obtained from the weather API) will be
added to a database every hour (in Task 3).
b) You need to add a set of business rules to ensure your random values represent real world
scenarios:
o the fridge works all the time,
o The washing machine works up to 3 continuous hours per day between 6am and 9pm (i.e.
it should stop working by 9 pm). The usage for the hours that the washing machine is not
working will be considered as zero. The washing machine can be used every day but only
once.
o The air conditioner works up to 10 hours (does not have to be continuous) per day
between 9am and 11pm (i.e. it should stop working by 11pm). The usage for the hours
that the air conditioner is not working will be considered as zero. The air conditioner
should only work when the temperature value is greater than 20.
To implement these rules, you will need to use flags and counters (e.g. a flag to make sure washing
machine only works once in 24 hours, and a counter to make sure the air con and the washing
machine do not work more than the hours specified).
(8 marks) (7 marks)
Task 3 Local Storage (10 marks):
You need to store part of the data locally on the mobile phone’s SQLite database. You will create and
maintain one table (HourlyUsage) that its structure will be similar to the usage table you created in
Phase 1. You will write the hourly usage of each appliance (that will be provided by the simulator
every hour) to the SQLite table first. The entries will be for the time 0 to 23 (24 hours) per day.
Your code logic should make sure after writing 24 records (for 24 hours of a day), at the end of the
day, all these 24 records are written (added) to the backend database of RESTful web services (by
calling the POST method). Then you need to delete all the existing data entries in the SQLite table.
This means the table always stores the hourly usage data for the current day.
Here, we assume the app works 24/7 without any disconnection.
During your interview, since we will not have 24 hour data to test this part. You will have only one
record for the hourly usage data that will be created by the simulator as soon as you start the app
during the interview. You need to add †††䕰⡥㠠⤠㱳⽲㸠യਾ †††ⱥ††㰠⽴㹴੮⁔†⁴⁴⁴†㱡⼠㹡൬੬†䡴⁴ ⹔⡳㉫†⥡㱨⁁⽮㹤൲੯⁃†††ㄼ㕲†⸊⁰㉰ㅬ㱮⽩㹥൮ੴ䵯䝥†㜯⸾㰊⁓⽔㹦൵੬㰠⼠㹳ੲ†㡣⠠㉐㕨⥙㩯⁵㰠⽤㸠൴੯†㩴⁵⁒†††㱥⽧㸠൴⥫†㩡
†㱭⽥㸠൳†䐠䄨䥡䱮†⁶†⁴⁁⁔⡰†‵㰠⽫㹳ഩਠ⁔†⥮†䔯 ⸠㱢⼠㹥൸੩†⁷⡥㡮⁴⥲㱧⁴⽥㹲മਠ⡔䑨† Ɑ†⁰㉴㑡†⥢㰠⽩㹦൩㱤⽴㹨ഠੴ⥥†䉤㩥䄠‼ ††⁵♥㭦㱳⼠㸼ൢੲ†‷⁶††⁵†㱷⼠㹢ਠ㩲†䠯⁴䑩⸨‵䡫
†⁷♮㬠††⠠†ぴ㱥⽲㹶ੲ㈭㍳⥩⁆⁹†⁴♧㭲㰠†⽊㹡൶′†††㉥†⁷㌠†㱯
⽩㸮ਮ†‼⁵⁂††䑬†⁹㰠⽶㹩 †
⁉⡥㡮⥳⁰㱩⽲㹳ഠ੦⡯䑲Ɽⱦ††⁰
㱡⽬㹥൮㉡㑲†⥴†㱴⁰⽩㹣൫ਠ㱡⽴㹥ഩਮ⥄†††‾㩤†⁴⁷⁙⁵㰠†⽭㹡൫† ⁴†⁴†㱴⼠㹴൨⁵⁴†ⸯ‾†⁌㱥⁵⽲㹥ഠ⁵‾㩤䡳⁵䑬†䡷⁴†㱡⼩㸠഼♳㭯‱‾
†…†⁰†㰻⽲㹴※⁴⁰♣㭴‾††⁰⁴⁴㰦ⁱ⽵㹯഻ੳ⸮†⡔㥨⥵㱲†⽩㹮൶੯⡫㩴† ††††㐱⸮㔠⁔†㥳⥡㱳⁷⽥㹬ൣ੯㱭⁴⽨㹥ഠੵ⡳䑥⁴Ⱳ† †ⱡ⁷††㈠㑴㰠⽥㹲ഠੳ⥳㰠†⼼㹢൲ਠ㰯 ⽭㹡൲੫㱳‼⽢㹲ഠਯ㰾⼩㸠ൔ੨䅥䵥䌠㱶⽥㹳൳†⁹†䡴䑨㔊††⁴㱧⽡㹫ഠ੨⁰†⸠‼ †⁶†††㱬⼠㹴൨㩤†㱤⽮㹧ഠੰㅥ䘠⁴‼ ⁷†⡯†⤠ⱴ㱥†⽲㹥൱ੵ㉩☨㭫
†⠠⁹⥴㱥⽥㹫੮㍤䠠 ††‾⠍‱
㰺⽲㸠യਾ⥥†㱭†⽳㹣൲㑥†䙷†ⱴ†
Ⱐ㱬‼⽢㹲ഠਯ†⁙㱲⁴⽨㹥ഠ੬㕯䙴‾†⡴⸠⁴ⱡ㱤⽮㹧൩ੴ⥶ⱡⱧ†ⱇ‼ ⱐ⁉ⱴ㱯⼩㸮ഠ㱨†⽵㹳ਠ䝥㩧㱴⼠㸼ൢੲ䄠 䤍⁶†⁴†䵬⁰⁔⡥⁷⁶⁴†㱯⽯㹮൳ਠ⁈†⁹†⁴†㉴⤠㩴㱰⼠㹡ഠ੭ㅡ䥥†㱥⽤㸬ഠ੩㉴⸠䅵 ⸀ 㰀 ⼀㸀ഀ㌀⸀ 䔀 㰀 ⼀㸀ഀ ⠀ ⤀⸀ 㰀 ⼀㸀ഀ㐀⸀ 㨀 䘀䤀㔀 㐀㘀䄀㈀ⴀⴀⴀ 㰀 ⼀㸀ഀ⸀ 㰀 ⼀㸀ഀ䰀 㨀 㰀 ⼀㸀ഀ䰀 䄀 ⸀ 㰀 ⼀㸀ഀ ⠀ 㰀 ⼀㸀ഀ⤀⸀ Ⰰ 㔀─ ⸀ 㰀 ⼀㸀ഀ㰀 ⼀㸀ഀ㰀 ⼀㸀ഀ䰀䔀䄀䔀 䔀⸀ 㰀 ⼀㸀ഀ䈀 Ⰰ ✀ 㰀 ⼀㸀ഀ ⸀ 䤀 ✀ 㰀 ⼀㸀ഀ ⸀ 㰀 ⼀㸀ഀ 䴀Ⰰ 㰀 ⼀㸀ഀ㨀⼀⼀⸀⸀⸀⼀ⴀ⼀⼀⼀⼀ⴀ⸀ 㰀 ⼀㸀ഀ 㰀 ⼀㸀ഀ ⸀ 㨀 㰀 ⼀㸀ഀ☀㬀 ☀㬀 ⼀ 㬀 㰀 ⼀㸀ഀ☀㬀 ☀㬀 㬀 㰀 ⼀㸀ഀ☀㬀 ☀㬀 Ⰰ ☀㬀 㬀 㰀 ⼀㸀ഀ☀㬀 䰀 ⸀ 㰀 ⼀㸀ഀ☀㬀㰀⼀㸀