Skip to content

Latest commit

 

History

History
115 lines (79 loc) · 6.06 KB

Report.md

File metadata and controls

115 lines (79 loc) · 6.06 KB

2020-sensor-miniproject Report

Contributors: Jyotsna Penumaka (BU ID: U13844479), Emanuel Perez (BU ID: U74196797)

We both contributed equally to the completion of the project. We had multiple zoom meetings over which we brainstormed and worked on the various tasks. We worked on separate repos and wrote our code for every task to make the most of this learning experience.

Task 0

1) What is the greeting string issued by the server to the client upon first connecting?

The greeting string issued by the server to the client upon first connecting : ECE Senior Capstone IoT simulator

Task 1

1) Add Python code to Websockets client that saves the JSON data to a text file as it comes in (message by message)

python3  -m sp_iotsim.server
python3 -m sp_iotsim.client -l log.txt

We added code to src/sp_iotsim/client.py to collect data in a text file, in this case log.txt.

Task 2

python3 analyze.py log.txt

We added code to analyze.py to complete this task. Most of the tasks were done using pandas built-in functions.

1) Report median and variance observed from temperature data

Temperature
Room Median Variance
Lab1 21.01 7.41

2) Report median and variance observed from the occupancy data

Occupancy
Room Median Variance
Lab1 5.00 5.05

3) Plots of Probability Distribution Functions for each Sensor

Screen Shot 2020-09-15 at 10 22 12 PM

Screen Shot 2020-09-15 at 10 21 46 PM

Screen Shot 2020-09-15 at 10 21 59 PM

4) Histogram Plots for each Sensor

CO2 Histogram

Occupancy Histogram

Temperature Histogram

5) What is the mean and variance of the time interval of the sensor readings? Please plot its probability distribution function. Does it mimic a well-known distribution for connection intervals in large systems?

Time Interval of the Sensor Readings
Mean Variance
0.968014 1.013983
Time Interval probability density function

Screen Shot 2020-09-15 at 10 21 35 PM

Time Interval Histogram

Screen Shot 2020-09-17 at 3 49 42 PM

Yes, it mimics the Erlang distribution which is used to predict waiting times in queuing systems. Erlang distrubution is also specific case of a Gamma distrubtion. Since the time intervals for all three rooms are the same, we are using one probability distribution function graph to represent them.

Task 3

1) Implement an algorithm that detects anomalies in temperature sensor data. Print the percent of "bad" data points and determine the temperature median and variance with these bad data points discarded--the same room you did in Task 2 Question 1.

python3 algorithm.py log.txt

Fraction of "Bad Readings" in temperature sensor data for Lab1:

Room Percentage Fraction
Lab1 1.11% 6/540

The temperature median and variance with these bad data points discarded:

Room Median Variance
Lab1 21.01 0.31

2) Does a persistent change in temperature always indicate a failed sensor?

Not necessarily. A minute change caused by opening doors or changing the AC does not indicate a failed sensor. However, a drastic change would indicate a failed sensor (big change → sensor fails). The rate of change needs to be consistent with reality for example it cannot go from 27 celsius to 41 or from 27 celsius to -26.

3) What are possible bounds on temperature for each room type?

Upper and Lower bounds were calculated using 68–95–99.7 rule, which would result in 95.45% of the values to lie within two standard deviations of the mean. This was used to filter the data in task 3. This was completed in algorithm.py.

Upper bounds : mean + (2 * standard deviation)

Lower bounds : mean - (2 * standard deviation)

room Upper Bound Lower Bound
lab1 15.51 26.40
class1 10.41 44.52
office 15.24 30.73

Task 4

1) How is this simulation reflective of the real world?

As stated before, the simulation follows the Erlang distribution used in queueing systems and alike. The simulation also takes into account that sensors, at times, fail to correctly collect information from their surroundings.

2) How is this simulation deficient? What factors does it fail to account for?

The simulation is deficient because it does not account for the time of the day and the change in temperature from opening or closing of the doors in the room. In other words, the simulation can have more realistic features to it.

3) How is the difficulty of initially using this Python websockets library as compared to a compiled language e.g. C++ websockets

Python websockets library was convenient to use since the functions were well documented and easy to find compared to C++ websockets.

4) Would it be better to have the server poll the sensors, or the sensors reach out to the server when they have data?

It is better for the server to poll the sensor to keep complicated situations to occur especially as the number of sensors increase.