ALGO_Density_ATY.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * @file ALGO_Density_ATY.c
  3. *
  4. * @param Project ALGO_Algorithm_ATY_LIB
  5. *
  6. * @author ATY
  7. *
  8. * @copyright
  9. * - Copyright 2017 - 2023 MZ-ATY
  10. * - This code follows:
  11. * - MZ-ATY Various Contents Joint Statement -
  12. * <a href="https://mengze.top/MZ-ATY_VCJS">
  13. * https://mengze.top/MZ-ATY_VCJS</a>
  14. * - CC 4.0 BY-NC-SA -
  15. * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
  16. * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
  17. * - Your use will be deemed to have accepted the terms of this statement.
  18. *
  19. * @brief Familiar functions of MilkContent algorithm
  20. *
  21. * @version
  22. * - 1_01_221217 > ATY
  23. * -# Preliminary version, first Release
  24. ********************************************************************************
  25. */
  26. #ifndef __ALGO_Density_ATY_H
  27. #define __ALGO_Density_ATY_H
  28. #include "INCLUDE_ATY.h"
  29. /******************************* For user *************************************/
  30. // #define __DEBUG_ALGO_Density_ATY
  31. /******************************************************************************/
  32. #define C_WATER 1
  33. #define C_ALCOHOL 2
  34. #define C_MAX 2
  35. extern uint8_t detectContent_Density;
  36. extern float speedAtRefT_Density;
  37. /**
  38. * @brief Calc pure water us speed at specified T
  39. * @param T Temperature
  40. * @note y = 0.0002x^3 - 0.0564x^2 - 5.1226x + 1401.4
  41. */
  42. #define PureWaterSpeed(T) (1401.4 + 5.1226 * T - 0.0564 * T * T + 0.0002 * T * T * T)
  43. /**
  44. * @brief Calc pure water density at specified T
  45. * @param T Temperature
  46. * @note y = -0.0038x^2 - 0.0475x + 1000.5
  47. */
  48. #define PureWaterDensity(T) (1000.5 - 0.0475 * T -0.0038 * T * T)
  49. #endif /* __ALGO_Density_ATY_H */
  50. /******************************** End Of File *********************************/