controller_temp.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef CONTROLLER_TEMP_H_
  2. #define CONTROLLER_TEMP_H_
  3. #include "util.h"
  4. #include "fixpt.h"
  5. #define CELSIUS(celsius) ((float)(celsius))
  6. /* Temperature controller PID parameters */
  7. #define CONTRTEMP_PID_KP_NORMAL 1.5
  8. #define CONTRTEMP_PID_KI_NORMAL 0.3
  9. #define CONTRTEMP_PID_KD_NORMAL 0.2
  10. #define CONTRTEMP_PID_D_DECAY_NORMAL 2.0
  11. /* Temperature controller boost (1) PID parameters */
  12. #if CONF_BOOST
  13. # define CONTRTEMP_PID_KP_BOOST1 1.5
  14. # define CONTRTEMP_PID_KI_BOOST1 0.4
  15. # define CONTRTEMP_PID_KD_BOOST1 0.5
  16. # define CONTRTEMP_PID_D_DECAY_BOOST1 2.0
  17. #endif
  18. /* Temperature controller boost (2) PID parameters */
  19. #if CONF_BOOST
  20. # define CONTRTEMP_PID_KP_BOOST2 1.5
  21. # define CONTRTEMP_PID_KI_BOOST2 0.5
  22. # define CONTRTEMP_PID_KD_BOOST2 1.0
  23. # define CONTRTEMP_PID_D_DECAY_BOOST2 2.0
  24. #endif
  25. /* Temperature controller integral part limits. */
  26. #define CONTRTEMP_NEGLIM_I CELSIUS(-30)
  27. #define CONTRTEMP_POSLIM_I CELSIUS(80)
  28. /* Temperature controller final limits. */
  29. #define CONTRTEMP_NEGLIM CELSIUS(0)
  30. #define CONTRTEMP_POSLIM CELSIUS(480)
  31. /* Temperature to current mapping. */
  32. #define CONTRTEMP_MAP_TEMPLO CELSIUS(0)
  33. #define CONTRTEMP_MAP_CURRLO AMPERE(0)
  34. #define CONTRTEMP_MAP_TEMPHI CELSIUS(250)
  35. #define CONTRTEMP_MAP_CURRHI AMPERE(5)
  36. /* Temperature controller default idle setpoint. */
  37. #define CONTRTEMP_DEF_IDLE_SETPOINT CELSIUS(150)
  38. enum contrtemp_boostmode {
  39. TEMPBOOST_NORMAL,
  40. #if CONF_BOOST
  41. TEMPBOOST_BOOST1,
  42. TEMPBOOST_BOOST2,
  43. #endif
  44. NR_BOOST_MODES,
  45. };
  46. void contrtemp_set_feedback(fixpt_t r);
  47. fixpt_t contrtemp_get_feedback(void);
  48. void contrtemp_update_setpoint(void);
  49. void contrtemp_set_idle_setpoint(fixpt_t w);
  50. void contrtemp_set_enabled(bool enabled);
  51. void contrtemp_set_emerg(bool emergency);
  52. bool contrtemp_in_emerg(void);
  53. bool contrtemp_is_idle(void);
  54. bool contrtemp_is_heating_up(void);
  55. enum contrtemp_boostmode contrtemp_get_boost_mode(void);
  56. void contrtemp_update_pid_config(void);
  57. void contrtemp_init(void);
  58. #endif /* CONTROLLER_TEMP_H_ */