tf.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef __TONGFEI_H__
  2. #define __TONGFEI_H__
  3. #include "comm.h"
  4. #include "sm.h"
  5. #include "plt.h"
  6. #define TF_NBR_MAX 4
  7. struct tongfei_t
  8. {
  9. char szinfo[32];
  10. int idx;
  11. char szdev_id[SNOW_ID_BUF_SIZE];
  12. struct comm_t comm;
  13. struct statemachine_t sm;
  14. int cmd;
  15. //0x0000
  16. int run_statue; //运行状态,0空闲 1准备启动 2运行 3 延时停机 4 故障
  17. char run_state_str[30];
  18. int io_in;
  19. int io_out;
  20. double in_water_temp; //进水口温度
  21. double out_water_temp; //出水口温度
  22. double in_evaporation_temp;//蒸发入口温度
  23. double out_evaporation_temp;//蒸发入口温度
  24. double ev_temp; //环境温度
  25. int expansion_valve_degree; //节流膨胀阀当前开度
  26. double in_water_press; //进水口压力
  27. double out_water_press; //出水口压力
  28. int Err_1;
  29. int Err_2;
  30. int Err_3;
  31. int Err_4;
  32. int FrequencyChangerErr;
  33. // 0x1000
  34. int runMode;//1制冷 2加热 3自循环 4自动
  35. char runMode_str[16];
  36. int ctlMode;
  37. char ctrMode_str[16];
  38. int settiing_temp; //预设温度
  39. /* param set */
  40. int cool_start_temp;
  41. int cool_stop_temp;
  42. int heat_start_temp;
  43. int heat_stop_temp;
  44. };
  45. extern struct tongfei_t tf[TF_NBR_MAX + 1];
  46. int tongfei_init( void );
  47. int tongfei_get_state( int idx );
  48. int tongfei_send_sm_cmd( int idx, int cmd );
  49. int tongfei_get_addr( int idx );
  50. int tongfei_chk_state_all( int stat);
  51. int tongfei_send_sm_cmd_all( int cmd );
  52. int tongfei_get_cmd( int idx );
  53. void tongfei_reset_cmd(int idx);
  54. int tongfei_get_comm_st(int idx);
  55. int tongfei_get_chan_idx(int idx);
  56. char* tongfei_get_comm_st_str(int idx);
  57. int tongfei_get_tick(int idx);
  58. int tongfei_get_nbr();
  59. int tongfei_get_tool_data(int idx,char* buf);
  60. int tongfei_get_tbmqtt_data(int idx,char* buf);
  61. int tongfei_get_cloud_data(int ctn_idx,int idx,char* buf);
  62. int tongfei_get_bkds_data(int idx,char *buf);
  63. int tongfei_get_init_data(int ctn_idx, int idx, char *buf);
  64. int tongfei_get_modbus_data(int idx,unsigned short* data);
  65. int tongfei_set_cool_start_temp(int idx, int val);
  66. int tongfei_set_cool_stop_temp(int idx, int val);
  67. int tongfei_set_heat_start_temp(int idx, int val);
  68. int tongfei_set_heat_stop_temp(int idx, int val);
  69. #endif