GY-63_MS5611/libraries/Temperature/readme.md

172 lines
5.7 KiB
Markdown
Raw Normal View History

2021-01-29 06:31:58 -05:00
[![Arduino CI](https://github.com/RobTillaart/Temperature/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
2021-12-28 13:11:26 -05:00
[![Arduino-lint](https://github.com/RobTillaart/Temperature/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/Temperature/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/Temperature/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/Temperature/actions/workflows/jsoncheck.yml)
2021-01-29 06:31:58 -05:00
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/Temperature/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/Temperature.svg?maxAge=3600)](https://github.com/RobTillaart/Temperature/releases)
2020-11-27 05:33:55 -05:00
# Temperature
2015-03-07 16:44:21 -05:00
2022-11-26 07:09:08 -05:00
Arduino library with temperature conversion and weather functions including dewPoint, humidex, heatIndex and wind-chill.
2015-03-07 16:44:21 -05:00
2021-01-29 06:31:58 -05:00
2020-11-27 05:33:55 -05:00
## Description
2015-03-07 16:44:21 -05:00
2021-01-29 06:31:58 -05:00
This library contains weather related functions.
These functions are approximations based on work of NOAA a.o.
2020-11-27 05:33:55 -05:00
These functions can be used with temperature and humidity sensors e.g.
2021-01-29 06:31:58 -05:00
DHT22 or Sensirion, to make a weather station application.
2022-01-07 03:05:22 -05:00
Note: pre-0.3.1 versions have incorrect heat-index.
2021-01-29 06:31:58 -05:00
## Interface
### Conversion
2021-12-28 13:11:26 -05:00
- **float Fahrenheit(float Celsius)** idem.
- **float Celsius(float Fahrenheit)** idem.
- **float Kelvin(float Celsius)** idem.
2021-01-29 06:31:58 -05:00
2022-11-26 07:09:08 -05:00
More converters are implemented in the **temperatureConverter** class below.
2022-01-09 05:07:58 -05:00
2021-01-29 06:31:58 -05:00
### DewPoint, humidex
2021-12-28 13:11:26 -05:00
- **float dewPoint(float Celsius, float humidity)** idem.
- **float dewPointFast(float Celsius, float humidity)** idem.
- **float humidex(float Celsius, float dewPoint)** idem.
2021-01-29 06:31:58 -05:00
### heatIndex
2021-12-28 13:11:26 -05:00
- **float heatIndex(float Fahrenheit, float humidity)** idem.
- **float heatIndexC(float Celsius, float humidity)** idem.
2021-01-29 06:31:58 -05:00
2022-01-07 03:05:22 -05:00
#### 0.3.0
2022-01-06 09:32:26 -05:00
The formula for the **heatIndex()** was taken from https://en.wikipedia.org/wiki/Heat_index.
Since version 0.3.0 the more elaborated version of https://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml
2022-11-26 07:09:08 -05:00
will be used.
Note: there will be performance differences.
2022-01-06 09:32:26 -05:00
Indicative table
2022-11-26 07:09:08 -05:00
| Fahrenheit | Celsius | description | colour code |
|:------------:|:---------:|:--------------|--------------:|
| 70-79 | 21-26 | warm | green |
| 80-89 | 26-32 | very warm | yellow |
| 90-104 | 32-40 | hot | orange |
| 105-129 | 40-54 | very hot | red |
| > 130 | > 54 | extreme hot | purple |
2022-01-07 03:05:22 -05:00
2021-01-29 06:31:58 -05:00
### WindChill
2021-12-28 13:11:26 -05:00
Wind speed @ 10 meter, if **convert** is true => wind speed will be converted to 1.5 meter
else ==> formula assumes wind speed @ 1.5 meter
2021-01-29 06:31:58 -05:00
2021-12-28 13:11:26 -05:00
- **float WindChill_F_mph(float Fahrenheit, float milesPerHour, bool convert = true)**
- **float WindChill_C_kmph(float Celsius, float kilometerPerHour, bool convert = true)**
- **float WindChill_C_mps(float Celsius, float meterPerSecond, bool convert = true)**
2020-11-27 05:33:55 -05:00
2022-01-09 14:35:35 -05:00
Indicative table (subjective).
2022-11-26 07:09:08 -05:00
| wind chill °C | description |
|:---------------:|:-----------------------|
| > -10 | cold |
| -10 .. -25 | very cold ! |
| -25 .. -35 | very very cold ! |
| -35 .. -55 | chance of frostbite |
| < -55 | serious dangerous |
2022-01-09 14:35:35 -05:00
2022-11-26 07:09:08 -05:00
----
2022-04-15 14:19:05 -04:00
# temperatureConverter class
2022-01-09 05:07:58 -05:00
Since version 0.3.2 a temperature convertor class is added to convert to and from
other (less known) temperature scales.
The idea is to set a value in one scale and retrieve it in the other.
As the converter holds the last value set, multiple conversions are easy.
See example.
The scales are typically named after their inventor.
Check Wikipedia for details about the scales.
2022-11-26 07:09:08 -05:00
| Name | units | 1° in °K | 0°C | 100°C | notes |
|:--------------|:-------:|:----------:|----------:|----------:|:--------|
| Celsius | °C | 1.000000 | 0.00 | 100.00 |
| Delisle | °De | 0.666666 | -100.00 | 50.00 |
| Fahrenheit | °F | 0.555556 | 32.00 | 212.00 |
| Kelvin | °K | 1.000000 | 273.15 | 373.15 |
| Newton | -- | 3.030303 | 0.00 | 33.00 | not the force.
| Rankine | °Ra | 0.555556 | 491.76 | 671.67 | 0°Ra == 0°K, steps == Fahrenheit.
| Reamur | °Re | 1.250000 | 0.00 | 80.00 |
| Romer | °Ro | 1.904762 | 7.50 | 60.00 |
2022-01-09 05:07:58 -05:00
Note: units to be verified.
Note: this class is slightly slower than direct conversion, but it
prevents to have 8 x 7 optimized functions.
2022-11-26 07:09:08 -05:00
## Interface
2022-01-09 05:07:58 -05:00
#### Constructor
- **temperatureConverter()** Constructor sets the default to zero degrees C.
#### setters
- **void setKelvin(float value = 0)**
- **void setCelsius(float value = 0)**
- **void setFahrenheit(float value = 0)**
- **void setReamur(float value = 0)**
- **void setRankine(float value = 0)**
- **void setDelisle(float value = 0)**
- **void setNewton(float value = 0)**
- **void setRomer(float value = 0)**
#### getters
- **void getKelvin()**
- **void getCelsius()**
- **void getFahrenheit()**
- **void getReamur()**
- **void getRankine()**
- **void getDelisle()**
- **void getNewton()**
- **void getRomer()**
2020-11-27 05:33:55 -05:00
## Operations
The functions have a limited scope so one cannot use it for all input values possible.
The user should be aware of that. Check the references mentioned in the code and or
2021-12-28 13:11:26 -05:00
Wikipedia to confirm the applicability of the values generated.
2020-11-27 05:33:55 -05:00
The functions do not check the inputs.
See examples for typical usage.
2021-12-28 13:11:26 -05:00
# Future
2022-11-26 07:09:08 -05:00
#### must
#### should
2021-12-28 13:11:26 -05:00
- improve documentation
2022-01-09 05:07:58 -05:00
- add short explanation?
2022-11-26 07:09:08 -05:00
- add formula for water boiling height
- https://en.wikipedia.org/wiki/High-altitude_cooking
- multiMap needed?
#### could