Database and data model - gpeipman/TemperatureStation GitHub Wiki
Database contains tables for ASP.NET Identity and sensor measurements. Authentication is important if web application is accessible from public web as web application allows to define new measurings and activate them. I don't describe here ASP.NET Identity data structures but the ones related to measurements.
- Sensor - sensors used to read data
- Measurement - measuring session during what sensors are read
- SensorRole - the role of sensor in measuring session (Room1, Room2, Kettle1, etc)
- Calculator - special class that provides one or more calculations based on readings or liquid characteristics
- Reading - sensor readings

Here is the short descritpion of data model. I'm binding sensor role to reading to avoid adding more fields and more complex relationships. Through sensor role it's easy to find a measurement and sensor.
Sensor | |
---|---|
Id | Id of sensor |
Name | Human understandable name of sensor |
Measurement | |
Id | Unique ID of measuring session |
Name | Name of measuring session |
IsActive | Is measuring session currently active |
FreezingPoint | Temperature where liquid starts turning to ice |
CoolingRate | Heat exchange rate by Newton's Law of Cooling |
OriginalGravity | Original gravity of fermenting liquid |
FinalGravity | Final gravity of fermented liquid |
AlcoholVolume | Alcohol content by volume (ABV) |
AlcoholWeight | Alcohol content by weight (ABW) |
SensorRole | |
Id | Unique ID of relation |
MeasurementId | Unique ID of measurement |
Sensor ID | Unique ID of sensor |
Name | Human understandable name of sensor role |
Calculators | |
Id | Unique ID of calculator |
MeasurementId | Measurement on what calculation is applied |
Name | Name of calculator defined by calculator class attribute |
Parameters | String with calculator parameters |
Readings | |
Id | Unique ID of sensor reading |
ReadingType | Discriminator field to detect the type of reading (SensorReading or CalculatorReading). SE - Sensor reading, CA - Calculator reading |
ReadingTime | Timestamp of sensor reading |
Value | The value of reading |
SensorRoleId | Sensor role related to reading |
CalculatorId | Calculator related to reading |