Define conversion functions for TD, T and RH
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef MAD_CORE_COMMON_H
|
||||
#define MAD_CORE_COMMON_H
|
||||
|
||||
#include "common/math.h"
|
||||
#include "common/types.h"
|
||||
#include "common/watchdog.h"
|
||||
|
||||
|
||||
43
src/common/math.c
Normal file
43
src/common/math.c
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "common.h"
|
||||
|
||||
// https://bmcnoldy.earth.miami.edu/Humidity.html
|
||||
// https://onlinelibrary.wiley.com/doi/abs/10.1002/andp.18280890511
|
||||
// https://onlinelibrary.wiley.com/doi/abs/10.1002/andp.18441370202
|
||||
|
||||
// NOTE: EXP and LN are exponential and natural logarithm functions
|
||||
|
||||
// Dewpoint TD
|
||||
// 243.04*(LN(RH/100)+((17.625*T)/(243.04+T)))/
|
||||
// (17.625-LN(RH/100)-((17.625*T)/(243.04+T)))
|
||||
float Dewp(float t, float rh)
|
||||
{
|
||||
// TODO
|
||||
UNUSED(tc);
|
||||
UNUSED(rh);
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
// Temperature T
|
||||
// 243.04*(((17.625*TD)/(243.04+TD))-LN(RH/100))/
|
||||
// (17.625+LN(RH/100)-((17.625*TD)/(243.04+TD)))
|
||||
float Temp(float td, float rh)
|
||||
{
|
||||
// TODO
|
||||
UNUSED(dc);
|
||||
UNUSED(rh);
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
// Relative Humidity RH
|
||||
// 100*(EXP((17.625*TD)/(243.04+TD))/
|
||||
// EXP((17.625*T)/(243.04+T)))
|
||||
float Rhum(float t, float td)
|
||||
{
|
||||
// TODO
|
||||
UNUSED(tc);
|
||||
UNUSED(dc);
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
8
src/common/math.h
Normal file
8
src/common/math.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef MAD_CORE_COMMON_MATH_H
|
||||
#define MAD_CORE_COMMON_MATH_H
|
||||
|
||||
float Dewp(float t, float rh);
|
||||
float Temp(float td, float rh);
|
||||
float Rhum(float t, float td);
|
||||
|
||||
#endif // MAD_CORE_COMMON_MATH_H
|
||||
Reference in New Issue
Block a user