Skip to content
Paul Beckman edited this page Jul 29, 2016 · 7 revisions

When a sensor reading is received, plenario looks up the sensor from which the reading was taken in order to determine which table to store its values in.

Sensor Table:

    sensor     |      properties       |  networkname  |              info
---------------+-----------------------+---------------+------------------------------------
    UBQ120     | ["magneticField.X",   | ArrayOfThings | {"datasheet": "UBQ120.datashe.et",
                  "magneticField.Y",                      "info": "all necessary info"}
                  "magneticField.Z"]

We then insert the values into the appropriate table.

Temperature Table:

     nodeid      |      datetime       |  sensor  | temperature | procedure
-----------------+---------------------+----------+-------------+------------
 ArrayOfThings1  | 2017-02-15 15:15:15 |  TMP112  |     89.3    |   236AF7
 ArrayOfThings1  | 2017-02-15 15:15:15 |  HBT147  |     90.1    |   376CA9

Magnetic Field Table:

     nodeid      |      datetime       |  sensor  |  X  |  Y  |  Z  | procedure
-----------------+---------------------+----------+-----+-----+-----+------------
 ArrayOfThings1  | 2017-02-15 15:15:15 |  UBQ120  | 0.7 | 1.3 | 4.2 |   382BB2

The rows in these tables contain all the calibrated and interpreted values that we received, along with a procedure identifier, which points to a table of all past and present procedures. These procedures describe all plugins used to convert the raw value to an understandable sensor reading, along with any other information that is deemed necessary to understanding how the reading was generated.

Procedure Lookup Table:

     key      |              procedure       
--------------+-------------------------------------
    236AF7    | {"plugins": [
                     "TMP112 decoder v2.3.5",
                     "TMP112 encoder v3.4.0",
                     "TMP112 Calibrator v6"
                     ],
                 "info": "all necessary information"
                }
Clone this wiki locally