ctn_cal.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef __CTN_CAL_H
  2. #define __CTN_CAL_H
  3. #include "plt.h"
  4. enum ctn_cal_err_t{
  5. CTN_CALERR_NONE = 0,
  6. CTN_CALERR_LAUNCH_GET_DATA_LINE_NBR = 1,
  7. CTN_CALERR_LAUNCH_GET_RECORD_DATA_ERR = 2,
  8. CTN_CALERR_LAUNCH_GET_CYCLE = 3,
  9. CTN_CALERR_LAUNCH_INSERT_ONE_LINR_DATA = 4,
  10. CTN_CALERR_RUN_UPDATE_SOC = 5,
  11. };
  12. struct ctn_cal_soc_t{
  13. double a1_chg;
  14. double b1_chg;
  15. double a2_chg;
  16. double b2_chg;
  17. double a1_dhg;
  18. double b1_dhg;
  19. double a2_dhg;
  20. double b2_dhg;
  21. double extre_p;
  22. double soc_base;
  23. double soc;
  24. double dhg_energy_basic;
  25. double dhg_energy_p;
  26. double dhg_energy_pr;
  27. double meter_neg_energy_base;
  28. double chg_energy_basic;
  29. double chg_energy_p;
  30. double chg_energy_pr;
  31. double meter_pos_energy_base;
  32. double last_p;
  33. int last_ctn_state;
  34. long long ts_last;
  35. };
  36. struct ctn_cal_t{
  37. struct ctn_cal_soc_t cal_soc;
  38. double cycle;
  39. int meter_model;
  40. char szmeter_model[20];
  41. int meter_idx;
  42. sqlite3* db;
  43. int cmd;
  44. struct statemachine_t sm;
  45. double meter_neg_energy_last;
  46. double soh;
  47. };
  48. int ctn_cal_init();
  49. int ctn_cal_get_tool_data(char* buf);
  50. int ctn_cal_set_cmd(int cmd);
  51. int ctn_cal_get_cmd( void );
  52. int ctn_cal_get_tb_data(char* data);
  53. int ctn_cal_get_state( void );
  54. int ctn_cal_set_soc(double soc);
  55. int ctn_cal_set_cycle(double soc);
  56. int ctn_cal_set_chg_param(double a1_chg,double b1_chg,double a2_chg,double b2_chg);
  57. int ctn_cal_set_dhg_param(double a1_dhg,double b1_dhg,double a2_dhg,double b2_dhg);
  58. int ctn_cal_set_soh(double soh);
  59. int ctn_cat_get_soc(void);
  60. int ctn_cal_get_cycle(void);
  61. #endif