zh200.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #ifndef ZH200_H
  2. #define ZH200_H
  3. #define ZH200_NBR_MAX (1)
  4. #include "plt.h"
  5. struct zh200_t
  6. {
  7. int idx_in_ess;
  8. int chan_idx;
  9. // int sn;
  10. char szinfo[32];
  11. int idx;
  12. char szdev_id[SNOW_ID_BUF_SIZE];
  13. // char szmodel[32];
  14. // int model;
  15. //int adr;
  16. int modbus_tcp_slave_port;
  17. int modbus_tcp_slave_port_EMA;
  18. char sztime[32];
  19. int cmd;
  20. unsigned short cmdpara[4];
  21. // int rawState;
  22. int cell_otp; // over temp protect
  23. int cell_utp; // under temp protect
  24. double max_v;
  25. double min_v;
  26. double socc;
  27. double socd;
  28. struct tick_t bsytik; /* ctn and sta */
  29. struct tick_t pcstik; /* pcs and ctn */
  30. struct tick_t bmstik; /* bms and ctn */
  31. struct power_t pow;
  32. struct statemachine_t sm;
  33. //run info
  34. char szRunInfo[256];
  35. };
  36. extern struct zh200_t zh200[ZH200_NBR_MAX + 1];
  37. int zh200_init(void);
  38. int zh200_send_cmd(int idx, int cmd);
  39. int zh200_set_aps(int idx, int P);
  40. int zh200_reset_aps(int idx);
  41. int zh200_get_ap(int idx);
  42. int zh200_get_aps(int idx);
  43. int zh200_get_last_aps(int idx);
  44. double zh200_get_soc(int idx);
  45. double zh200_get_soh(int idx);
  46. void zh200_set_state(int idx, int state, int err);
  47. int zh200_get_state(int idx);
  48. char *zh200_get_state_str(int idx);
  49. char *zh200_get_err_str(int idx);
  50. int zh200_enable_bsytikchk(int idx);
  51. int zh200_disable_bsytikchk(int idx);
  52. int zh200_get_bsytikchk_timeout(int idx);
  53. int zh200_get_bsytikchk_from_host(int idx);
  54. int zh200_get_bsytikchk_en(int idx);
  55. int zh200_enable_pcs_bsytiksnd(int idx);
  56. int zh200_disable_pcs_bsytiksnd(int idx);
  57. int zh200_get_pcs_bsytiksnd_en(int idx);
  58. int zh200_enable_bms_bsytiksnd(int idx);
  59. int zh200_disable_bms_bsytiksnd(int idx);
  60. int zh200_get_bms_bsytiksnd_en(int idx);
  61. int zh200_get_norm_cap(int idx);
  62. int zh200_get_norm_pow(int idx);
  63. int zh200_get_min_pow(int idx);
  64. int zh200_get_cmd(int idx);
  65. void zh200_reset_cmd(int idx);
  66. int zh200_get_dhgable(int idx);
  67. int zh200_get_chgable(int idx);
  68. void zh200_set_dhgable(int idx, int val);
  69. void zh200_set_chgable(int idx, int val);
  70. int zh200_is_aps_changed(int idx);
  71. int zh200_set_socd(int idx, double val);
  72. int zh200_set_socc(int idx, double val);
  73. double zh200_get_socd(int idx);
  74. double zh200_get_socc(int idx);
  75. int zh200_get_cell_otp(int idx);
  76. int zh200_get_cell_utp(int idx);
  77. int zh200_get_step(int idx);
  78. int zh200_get_tick(int idx);
  79. double zh200_get_tick_ave(int idx);
  80. double zh200_get_tick_cur(int idx);
  81. double zh200_get_tick_max(int idx);
  82. int zh200_cfg_save_socd(int idx);
  83. int zh200_cfg_save_socc(int idx);
  84. int zh200_get_err(int idx);
  85. int zh200_get_tool_data(int idx, char *buf);
  86. unsigned short zh200_get_cmd_param1(int idx);
  87. unsigned short zh200_get_cmd_param2(int idx);
  88. unsigned short zh200_get_cmd_param3(int idx);
  89. unsigned short zh200_get_cmd_param4(int idx);
  90. int zh200_set_cmd(int idx, int cmd);
  91. int zh200_set_cmd_param1(int idx, unsigned short param);
  92. int zh200_set_cmd_param2(int idx, unsigned short param);
  93. int zh200_set_cmd_param3(int idx, unsigned short param);
  94. int zh200_set_cmd_param4(int idx, unsigned short param);
  95. int zh200_set_bsytikchk_from_host(int idx, unsigned char tick);
  96. char *zh200_get_devid(int idx);
  97. int zh200_get_init_data(int idx, char *buf);
  98. int zh200_get_tbmqtt_data(int idx, char *buff);
  99. #endif /* ZH200_H */