ies1000.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. #ifndef __IES1000_H__
  2. #define __IES1000_H__
  3. enum ies1000_cmd_t{
  4. CMD_ies1000_set_dev_aps = 0,
  5. CMD_ies1000_set_dev_startcmd,
  6. CMD_ies1000_set_dev_stopcmd,
  7. CMD_ies1000_set_dev_idlecmd,
  8. CMD_ies1000_set_dev_resetcmd,
  9. };
  10. enum ies1000_runstat_t{
  11. IES1000_RUNSTAT_STOP = 0,
  12. IES1000_RUNSTAT_IDLE = 1,
  13. IES1000_RUNSTAT_DHG = 2,
  14. IES1000_RUNSTAT_CHG = 3,
  15. };
  16. enum ies1000_runmod_t{
  17. IES1000_RUNMOD_ONGRID = 0,
  18. IES1000_RUNMOD_OFFGRID = 1,
  19. IES1000_RUNMOD_ONOFFGRID = 2,
  20. };
  21. struct ies1000_t{
  22. //int chan_idx;
  23. char szinfo[32];
  24. char szmodel[32];
  25. int model;
  26. //int adr; // modbus rtu addr, by cfg
  27. struct tick_t bsytik;
  28. struct power_t pow;
  29. struct comm_t comm;
  30. //struct dac_t dac;
  31. struct statemachine_t sm;
  32. int cmd; // sm cmd
  33. /* F0 basic param */
  34. int cmdsrc;
  35. char szcmdsrc[16];
  36. int runmod;
  37. char szrunmod[16];
  38. int workmod;
  39. char szworkmod[16];
  40. //int onoff_grid_dft;
  41. int switch_initmod;
  42. char szswitch_initmod[16];
  43. int offgrid_freq;
  44. char szoffgrid_freq[16];
  45. int offgrid_vol_set;
  46. int reactive_p_set_mod;
  47. char szreactive_p_set_mod[16];
  48. int active_p_set; /* sync to active_p_set of the ies1000 device */
  49. int reactive_p_set;
  50. int cv_v_set; /* constant voltage mode voltage set */
  51. int cc_c_set; /* constant current mode current set */
  52. int pow_set_src; /* power cmd source */
  53. char szpow_set_src[8];
  54. int ins_det; /* insulation detect */
  55. /* F1 system info */
  56. int dc_ovp; /* 母线过压保护值 */
  57. int dc_uvp; /* 母线欠压保护值 */
  58. int dc_dfp; /* dc bus voltage difference protetion */
  59. int dc_ocp; /* 直流侧过流保护值 */
  60. int env_otp; /* over environment temp protection */
  61. int reactor_otp; /* diankangqi */
  62. int igbt_otp;
  63. /* F4 start stop param */
  64. int startcmd;
  65. int stopcmd;
  66. int idlecmd;
  67. int err_rstcmd;
  68. /* F5 IES1000 control param */
  69. int gridfreq_autoadj;
  70. int pow_adjrate_en;
  71. int pow_adjrate_set;
  72. int isl_det;
  73. /* FH user param */
  74. int sync_year;
  75. int sync_month;
  76. int sync_day;
  77. int sync_hour;
  78. int sync_min;
  79. int sync_sec;
  80. /* FU monitor param */
  81. int runstatus; /*IES1000运行状态*/
  82. char szrunstatus[16];
  83. int dc_v; /* 电池电压 */
  84. int dc_c; /* 直流电流 */
  85. double grid_freq; /* 电网频率 */
  86. double grid_v; /* 电网电压 */
  87. double ac_c; /* 交流电流 */
  88. double ua;
  89. double ub;
  90. double uc;
  91. double ia;
  92. double ib;
  93. double ic;
  94. int ap; /* 输出总有功功率 */
  95. int dc_p; /* 直流功率 */
  96. int ac_breaker; /* 交流断路器状态 */
  97. int dc_breaker; /* 直流断路器状态 */
  98. int dcbuf_cont;
  99. int emg_btn; /* emergence button */
  100. double chg_e_day; /*今日充电量*/
  101. double dhg_e_day; /* 今日放电量 */
  102. double chg_e_total; /*累计充电量*/
  103. double dhg_e_total; /*累计放电量*/
  104. int temp_igbt_a;
  105. int temp_igbt_b;
  106. int temp_igbt_c;
  107. int temp_reactor;
  108. int temp_env;
  109. int errstatus; /*IES1000故障状态*/
  110. unsigned short faults[6 + 1]; // fault state word 1 - 6
  111. unsigned short warns[6 + 1]; // warning state word 1 - 6
  112. };
  113. extern struct ies1000_t ies1000[IES1000_NBR_MAX + 1];
  114. int ies1000_init();
  115. int ies1000_send_sm_cmd( int idx, int cmd );
  116. int ies1000_get_ap( int idx );
  117. int ies1000_get_ac_brk( int idx );
  118. int ies1000_get_dc_brk( int idx );
  119. int ies1000_get_errstat( int idx );
  120. int ies1000_get_emg_btn( int idx );
  121. double ies1000_get_ua( int idx );
  122. double ies1000_get_ub( int idx );
  123. double ies1000_get_uc( int idx );
  124. double ies1000_get_ia( int idx );
  125. double ies1000_get_ib( int idx );
  126. double ies1000_get_ic( int idx );
  127. int ies1000_get_temp_igbt_a( int idx );
  128. int ies1000_get_temp_igbt_b( int idx );
  129. int ies1000_get_temp_igbt_c( int idx );
  130. int ies1000_get_temp_reactor( int idx );
  131. int ies1000_get_temp_env( int idx );
  132. int ies1000_get_state( int idx );
  133. int ies1000_get_step( int idx );
  134. int ies1000_get_tick( int idx );
  135. double ies1000_get_tick_ave( int idx );
  136. double ies1000_get_tick_cur( int idx );
  137. double ies1000_get_tick_max( int idx );
  138. char* ies1000_get_state_str( int idx );
  139. char* ies1000_get_err_str( int idx );
  140. int ies1000_chk_state( int idx, int stat );
  141. int ies1000_load_params( int idx );
  142. int ies1000_set_aps( int idx, int aps);
  143. int ies1000_get_aps(int idx);
  144. int ies1000_reset_aps(int idx);
  145. int ies1000_get_runstat( int idx );
  146. char* ies1000_get_runstat_str( int idx );
  147. int ies1000_get_dcv( int idx );
  148. int ies1000_get_dcc( int idx );
  149. int ies1000_get_dc_dfp( int idx );
  150. int ies1000_set_dev_startcmd( int idx );
  151. int ies1000_set_dev_stopcmd( int idx );
  152. int ies1000_set_dev_idlecmd( int idx );
  153. int ies1000_set_dev_resetcmd( int idx );
  154. int ies1000_reset_bsytikchk(int idx);
  155. int ies1000_is_bsytikchk_timeout(int idx);
  156. int ies1000_set_bsytikchk_en(int idx, int val);
  157. int ies1000_get_bsytikchk_en(int idx);
  158. int ies1000_get_bsytikchk_from_host(int idx);
  159. int ies1000_set_bsytik(int idx);
  160. int ies1000_get_dev_aps( int idx );
  161. int ies1000_get_cmd( int idx );
  162. void ies1000_reset_cmd( int idx );
  163. int ies1000_is_aps_changed(int idx);
  164. int ies1000_get_last_aps(int idx);
  165. int ies1000_set_dac_param_en(int idx, int val);
  166. double ies1000_get_gridv( int idx );
  167. double ies1000_get_gridc( int idx );
  168. int ies1000_get_comm_st(int idx);
  169. int ies1000_get_runmod( int idx );
  170. int ies1000_get_chan_idx(int idx);
  171. int ies1000_get_adr(int idx);
  172. char* ies1000_get_comm_state_str(int idx);
  173. double ies1000_get_dac_ave(int idx);
  174. double ies1000_get_dac_cur(int idx);
  175. double ies1000_get_dac_max(int idx);
  176. int ies1000_get_dc_ovp( int idx );
  177. int ies1000_get_dc_uvp( int idx );
  178. int ies1000_get_env_otp( int idx );
  179. int ies1000_get_reactor_otp( int idx );
  180. int ies1000_get_igbt_otp( int idx );
  181. double ies1000_get_grid_freq( int idx );
  182. int ies1000_get_dcp( int idx );
  183. int ies1000_get_breaker_ac( int idx );
  184. int ies1000_get_breaker_dc( int idx );
  185. int ies1000_get_dcbuf_cont( int idx );
  186. unsigned short* ies1000_get_faults(int idx);
  187. unsigned short* ies1000_get_warns(int idx);
  188. int ies1000_get_dac_param_en(int idx);
  189. char* ies1000_get_info_str(int idx);
  190. double ies1000_get_chg_e_total(int idx);
  191. double ies1000_get_dhg_e_total(int idx);
  192. int ies1000_get_tool_data(int idx,char* buf);
  193. int ies1000_get_tbmqtt_main_data(int idx,char* buf);
  194. int ies1000_get_tbmqtt_secondy_data(int idx,char* buf);
  195. int ies1000_get_cloud_main_data(int cnt_idx,int idx,char* buf);
  196. int ies1000_get_cloud_secondy_data(int cnt_idx,int idx,char* buf);
  197. int ies1000_get_bkds_data(int idx,char* buf);
  198. #endif