it6000.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. #ifndef __IT6000_H__
  2. #define __IT6000_H__
  3. #define IT6000_NBR_MAX (1)
  4. enum it6000_cmd_t{
  5. CMD_it6000_set_dev_aps = 0,
  6. CMD_it6000_set_dev_startcmd,
  7. CMD_it6000_set_dev_stopcmd,
  8. };
  9. // enum it6000_runstat_t{
  10. // IES1000_RUNSTAT_STOP = 0,
  11. // IES1000_RUNSTAT_IDLE = 1,
  12. // IES1000_RUNSTAT_DHG = 2,
  13. // IES1000_RUNSTAT_CHG = 3,
  14. // };
  15. // enum ies1000_runmod_t{
  16. // IES1000_RUNMOD_ONGRID = 0,
  17. // IES1000_RUNMOD_OFFGRID = 1,
  18. // IES1000_RUNMOD_ONOFFGRID = 2,
  19. // };
  20. struct it6000_t{
  21. //int chan_idx;
  22. char szinfo[32];
  23. char szmodel[32];
  24. int model;
  25. //int adr; // modbus rtu addr, by cfg
  26. struct tick_t bsytik;
  27. struct power_t pow;
  28. struct comm_t comm;
  29. //struct dac_t dac;
  30. struct statemachine_t sm;
  31. int cmd; // sm cmd
  32. //充放电设定的保护值
  33. float uvp_set;
  34. float ovp_set;
  35. float ocp_set;//总是正值,放电时下发为负值,充电时下发为正值
  36. float Vh_set;
  37. float Vl_set;
  38. //sys
  39. int sysStatus;
  40. char szSysStatus[20];
  41. //dc info
  42. int dc_mode;
  43. char szDc_mode[20];
  44. float dc_volt;
  45. float dc_volt_rise;
  46. float dc_volt_fall;
  47. float dc_current;//pos:chg;neg:dhg
  48. float dc_current_rise;
  49. float dc_current_fall;
  50. float dc_v_high;
  51. float dc_v_low;
  52. float dc_i_high;
  53. float dc_i_low;
  54. int cc_speed_state;
  55. int cv_speed_state;
  56. float power_high;
  57. float power_low;
  58. //meter
  59. float meter_v_rms;
  60. float meter_i_rms;
  61. float meter_p_rms;
  62. int meter_op_reg;
  63. int meter_state_reg;
  64. int meter_ques_reg;
  65. //prot
  66. int dc_ovp_enable;
  67. float dc_ovp;
  68. float dc_ovp_delay;
  69. int dc_ocp_enable;
  70. float dc_ocp;
  71. float dc_ocp_delay;
  72. int dc_opp_enable;
  73. float dc_opp;
  74. float dc_opp_delay;
  75. int dc_ucp_enable;
  76. float dc_ucp;
  77. float dc_ucp_delay;
  78. float dc_ucp_warmup;
  79. int dc_uvp_enable;
  80. float dc_uvp;
  81. float dc_uvp_delay;
  82. float dc_uvp_warmup;
  83. int sw_prot;
  84. int hw_prot;
  85. };
  86. extern struct it6000_t it6000[IT6000_NBR_MAX + 1];
  87. int it6000_get_cmd( int idx );
  88. int it6000_get_comm_st(int idx);
  89. void it6000_reset_cmd(int idx);
  90. int it6000_get_state( int idx );
  91. char* it6000_get_state_str( int idx );
  92. int it6000_get_step( int idx );
  93. int it6000_get_tick( int idx );
  94. double it6000_get_tick_ave( int idx );
  95. double it6000_get_tick_cur( int idx );
  96. double it6000_get_tick_max( int idx );
  97. char* it6000_get_err_str( int idx );
  98. int it6000_chk_state( int idx, int stat );
  99. int it6000_get_sysstatus( int idx );
  100. int it6000_get_dc_mode( int idx );
  101. float it6000_get_dc_volt( int idx );
  102. float it6000_get_dc_volt_rise( int idx );
  103. float it6000_get_dc_volt_fall( int idx );
  104. float it6000_get_dc_current( int idx );
  105. float it6000_get_dc_current_rise( int idx );
  106. float it6000_get_dc_current_fall( int idx );
  107. float it6000_get_dc_v_high( int idx );
  108. float it6000_get_dc_v_low( int idx );
  109. float it6000_get_dc_i_high( int idx );
  110. float it6000_get_dc_i_low( int idx );
  111. int it6000_get_cc_speed_state( int idx );
  112. int it6000_get_cv_speed_state( int idx );
  113. float it6000_get_power_high( int idx );
  114. float it6000_get_power_low( int idx );
  115. float it6000_get_meter_v_rms( int idx );
  116. float it6000_get_meter_i_rms( int idx );
  117. float it6000_get_meter_p_rms( int idx );
  118. int it6000_get_meter_op_reg( int idx );
  119. int it6000_get_meter_state_reg( int idx );
  120. int it6000_get_meter_ques_reg( int idx );
  121. int it6000_get_dc_ovp_enable( int idx );
  122. float it6000_get_dc_ovp( int idx );
  123. float it6000_get_dc_ovp_delay( int idx );
  124. int it6000_get_dc_ocp_enable( int idx );
  125. float it6000_get_dc_ocp( int idx );
  126. float it6000_get_dc_ocp_delay( int idx );
  127. int it6000_get_dc_opp_enable( int idx );
  128. float it6000_get_dc_opp( int idx );
  129. float it6000_get_dc_opp_delay( int idx );
  130. int it6000_get_dc_ucp_enable( int idx );
  131. float it6000_get_dc_ucp( int idx );
  132. float it6000_get_dc_ucp_delay( int idx );
  133. float it6000_get_dc_ucp_warmup( int idx );
  134. int it6000_get_dc_uvp_enable( int idx );
  135. float it6000_get_dc_uvp( int idx );
  136. float it6000_get_dc_uvp_delay( int idx );
  137. float it6000_get_dc_uvp_warmup( int idx );
  138. int it6000_get_sw_prot( int idx );
  139. int it6000_get_hw_prot( int idx );
  140. int it6000_set_aps(int idx, int aps);
  141. int it6000_send_sm_cmd( int idx, int val );
  142. int it6000_init();
  143. int it6000_get_tool_data(int idx,char* buf);
  144. char* it6000_get_info_str(int idx);
  145. int it6000_get_chan_idx(int idx);
  146. int it6000_get_adr(int idx);
  147. char* it6000_get_comm_state_str(int idx);
  148. double it6000_get_dac_ave(int idx);
  149. double it6000_get_dac_cur(int idx);
  150. double it6000_get_dac_max(int idx);
  151. int it6000_get_dac_param_en(int idx);
  152. int it6000_get_bsytikchk_en(int idx);
  153. int it6000_get_bsytikchk_from_host(int idx);
  154. int it6000_set_bsytik(int idx);
  155. int it6000_set_bsytikchk_en(int idx, int val);
  156. int it6000_set_dac_param_en(int idx, int val);
  157. int it6000_is_bsytikchk_timeout(int idx);
  158. int it6000_get_aps(int idx);
  159. int it6000_get_ap( int idx );
  160. int it6000_reset_aps(int idx);
  161. int it6000_get_tbmqtt_main_data(int idx,char* buf);
  162. int it6000_get_tbmqtt_secondy_data(int idx,char* buf);
  163. #endif