dtsd1352.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #ifndef __DTSD1352_H__
  2. #define __DTSD1352_H__
  3. #include "misc.h"
  4. #include "chan.h"
  5. #define DTSD1352_NBR_MAX 8
  6. struct dtsd1352_t{
  7. int bEn;
  8. char szinfo[32];
  9. char szaddr[16];
  10. int chanresetcnt;
  11. double polltotalcnt;
  12. double polltotaltime;
  13. double pollave;
  14. double pollmax;
  15. int cmd;
  16. struct comm_t comm;
  17. struct statemachine_t sm;
  18. double com_active_e;
  19. double com_active_p;
  20. double pos_active_e;
  21. double pos_active_dem;
  22. double neg_active_e;
  23. double pwr_factor;
  24. int PT;
  25. int CT;
  26. double ua;
  27. double ub;
  28. double uc;
  29. double ia;
  30. double ib;
  31. double ic;
  32. double freq;
  33. /*
  34. 分相电压电流总畸变率H =data*0.01 data 为通讯中的谐波含量,
  35. 计算值单位为%,谐波含量是谐波/基波,所以有几率数值会大于 1
  36. */
  37. double THDUa;
  38. double THDUb;
  39. double THDUc;
  40. double THDIa;
  41. double THDIb;
  42. double THDIc;
  43. double total_fund_ap; //总基波有功功率
  44. double total_fund_rp; // 总基波无功功率
  45. double total_harm_ap; // 总谐波有功功率
  46. double total_harm_rp; // 总谐波无功功率
  47. };
  48. extern struct dtsd1352_t dtsd1352[DTSD1352_NBR_MAX + 1];
  49. int dtsd1352_init();
  50. int dtsd1352_get_cmd( int idx );
  51. void dtsd1352_reset_cmd(int idx);
  52. int dtsd1352_get_state( int idx);
  53. char* dtsd1352_get_state_string( int idx);
  54. int dtsd1352_chk_state_all( int stat);
  55. int dtsd1352_send_sm_cmd( int idx, int val );
  56. int dtsd1352_chk_state( int stat);
  57. int dtsd1352_send_sm_cmd_all( int val );
  58. int dtsd1352_get_com_ap( int idx );
  59. double dtsd1352_get_com_ae( int idx );
  60. double dtsd1352_get_pos_ae( int idx );
  61. double dtsd1352_get_neg_ae( int idx );
  62. double dtsd1352_get_ua( int idx );
  63. double dtsd1352_get_ub( int idx );
  64. double dtsd1352_get_uc( int idx );
  65. double dtsd1352_get_ia( int idx );
  66. double dtsd1352_get_ib( int idx );
  67. double dtsd1352_get_ic( int idx );
  68. double dtsd1352_get_pwrfct( int idx );
  69. int dtsd1352_get_comm_st(int idx);
  70. void dtsd1352_set_dac_param_en(int idx, int val);
  71. double dtsd1352_get_THDUa( int idx );
  72. double dtsd1352_get_THDUb( int idx );
  73. double dtsd1352_get_THDUc( int idx );
  74. double dtsd1352_get_THDIa( int idx );
  75. double dtsd1352_get_THDIb( int idx );
  76. double dtsd1352_get_THDIc( int idx );
  77. double dtsd1352_get_total_fund_ap( int idx );
  78. double dtsd1352_get_total_harm_ap( int idx );
  79. double dtsd1352_get_total_fund_rp( int idx );
  80. double dtsd1352_get_total_harm_rp( int idx );
  81. char* dtsd1352_get_info_str(int idx);
  82. int dtsd1352_get_sm_step(int idx);
  83. char* dtsd1352_get_sm_err_str(int idx);
  84. int dtsd1352_get_chan_idx(int idx);
  85. int dtsd1352_get_adr(int idx);
  86. int dtsd1352_get_tick(int idx);
  87. char* dtsd1352_get_comm_state_str(int idx);
  88. int dtsd1352_get_PT(int idx);
  89. int dtsd1352_get_CT(int idx);
  90. double dtsd1352_get_freq( int idx );
  91. int dtsd1352_get_nbr();
  92. int dtsd1352_get_tool_data(int idx,char* buf);
  93. int dtsd1352_get_tbmqtt_data(int idx,char* buf);
  94. int dtsd1352_get_cloud_data(int ctn_idx,int idx,char* buf);
  95. int dtsd1352_get_bkds_data(int idx,char* buf);
  96. #endif