Download presentation
Presentation is loading. Please wait.
1
1 Design II : Plant Care System Sushant Jain Jong Hee Kang Daniel Lloyd
2
2 Scenario Buy a plant Buy some sensors/actuators Attach sensors/actuators to the plant Subscribe to a plant care service
3
3 Picture Network Data Store Service Sensors/ Actuators ID tag Gateway Dashed Line : Short-rage wireless communication(e.g. RF)
4
4 We’ll talk about Communication Data Store Service
5
5 Communication How to transfer data from sensor to data store? Packet format URL : pointer to semantics of DATA URLDATA
6
6 From Sensor to Data Store Sensors broadcast data to nearest node Intermediate nodes add data to the incoming data packet URL1DATA1URL1DATA1URL2DATA2 Intermediate Node Next
7
7 From Sensor to Data Store temp.com63temp.com63plant.comID:45236temp.com63plant.comID:45236myhome.netroom23 Sensor ID tag(plant) Gateway(in a room)
8
8 Pros & Cons + Do not need to configure sensors We can attach additional sensors without configuration - How to associate sensor data with a specific object correctly? Plant A may catch Plant B’s data Recursion
9
9 Alternative Ideas Configure sensors So that they can send the object ID with data Use 3-D location sensing technology for associating data with object
10
10 Semantics of data Problem: how do you interpret “raw data” from the devices only device manufacturer knows about the data format standard is needed so that services can be built on top of raw data
11
11 Self describing data Data contains information which can be used to interpret it. Sending code along with data pointer to code(URL) data itself can be a java object(serializable) which implements some standard interface data with a pointer to a service which converts raw data to meaningful object. (rmi)
12
12 Reflection Create an instance of a class whose name is not known until runtime. Determine the class of an object. Get information about a class's modifiers, fields, methods, constructors, and superclasses. Find out what constants and method declarations belong to an interface. Get and set the value of an object's field, even if the field name is unknown to your program until runtime. Invoke a method on an object, even if the method is not known until runtime.
13
13 Design choice Data packets with Pointer to code and data URL#rawdata processing data packet locally: reflection based approach remotely: RMI based URL has the information about the path of the class file, name of the class www.temperature-1.com/temperature-1.class/
14
14 How it happens !! From datapacket:: String classname, String rawdata // may require downloading the class classname Class ctemp = Class.forName(classname) // cache this object ctemp to handle subsequent //packets from that particular sensor Object otemp = ctemp.newInstance(rawdata) Now one can query this object to see what all interfaces it implements, what all functions are available etc….for example otemp may implement interface Temperature
15
15 Sensors sending Objects Data packets with a java object URL#JavaObject object should be serializable processing data packet use(Object Output Stream, Object Input Stream) readObject, writeObject functions can determine the class of object, (using reflection)
16
16 pros/cons + Leverages off java reflection capabilities - Locks everything in Java, all data is basically Java objects + devices are dumb, only assumption is the format of data that they send, which is extremely simple - run untrusted code on your machine
17
17 Standardization/Extensibility Every manufacturer of a particular device implements a standard interface It can extend the interface to provide more functionality Services query the class of an object and can provide enhanced functionality if additional functions are available This allows devices with similar but different capabilities to be used for same service depending upon availability
18
18 What’s realisitc? We’ve been operating under the assumption that the DataStore knows everything. A Good assumption for thinking about applications. But not a realistic assumption. Typically in a database, you only care about the current value (current model of the world), not how it changes over time.
19
19 Kinds of single source data Current value Average value Average over what? Last millisecond? Last year? History Sampled how often? Rate of change First derivative? Second derivative?
20
20 What should the “Data Store” store? Instead of storing everything, store nothing. Data Store serves as a gateway to the data: A DataPort. A DataPort serves as a locus of data, a place where data is channeled to and from.
21
21 DataPort Sensors Actuators DataPort RF/Network connection
22
22 What does the DataPort know? The DataPort only knows atomic pieces of information: what the sensors tell it. There is no correlation of information in the DataPort. There are no views supported in the DataPort.
23
23 ViewPort A ViewPort runs on top of potentially several DataPorts. A ViewPort supports additional Interfaces which build off of the data contained in one or more DataPorts or ViewPorts. Average temperature. Location History
24
24 ViewPort DataPort ViewPort
25
25 Interface of DataPort and ViewPort DataPort and ViewPort have the same interface: [ selection method]> Every ViewPort and DataPort contains a list of Interfaces of the objects that they contain or can indirectly retrieve. > returns the set of all interfaces supported by that DataPort or ViewPort.
26
26 Example > {Plant, Temp, Room, etc.} { … return room.contains(plant.getLocation()) && room.contains(temp.getLocation()); }> {,,...} Based on these tuples, a ViewPort can create and offer the PlantRoomtemp class.
27
27 Advantages Flexible Arbitrary selection method. ViewPort can be implemented to support any kind of combination of the data, in anyway. If a DataPort or ViewPort contains a collection that implements a more specific interface, these objects can be used. Can dynamically add ViewPort.
28
28 Disadvantages Inflexible Locks in Java. Locks in SQL like query language. Difficult to dynamically create ViewPort.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.