procotol.go 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. package protocol
  2. import (
  3. "context"
  4. "github.com/gogf/gf/v2/frame/g"
  5. )
  6. type WaterSystem struct {
  7. WaterHeaderStatus
  8. WaterCollector
  9. OutdoorUnit
  10. }
  11. type WaterHeaderStatus struct {
  12. Power1 int `json:"power_1"` // 分水器-1开关 1关 0开
  13. Power2 int `json:"power_2"` // 分水器-2开关 1关 0开
  14. Power3 int `json:"power_3"` // 分水器-3开关 1关 0开
  15. Power4 int `json:"power_4"` // 分水器-4开关 1关 0开
  16. Power5 int `json:"power_5"` // 分水器-5开关 1关 0开
  17. Power6 int `json:"power_6"` // 分水器-6开关 1关 0开
  18. Power7 int `json:"power_7"` // 分水器-7开关 1关 0开
  19. Power8 int `json:"power_8"` // 分水器-8开关 1关 0开
  20. HeaderPower int `json:"header_power"` // 运行状态 1开 0关
  21. InletPressure float32 `json:"inlet_pressure"` // 进水压力
  22. OutletPressure float32 `json:"outlet_pressure"` // 出水压力
  23. PressureDifference float32 `json:"pressure_difference"` // 压力差
  24. FaultCode int `json:"fault_code"` // 故障码
  25. FillValve int `json:"fill_valve"` // 补水阀 0-关阀; 1-打开
  26. /*
  27. 0-第 0 档(全关)
  28. 1-第 1 档(30%)
  29. 2-第 2 挡(40%)
  30. 3-第 3 挡(50%)
  31. 4-第 4 挡(60%)
  32. 5-第 5 挡(70%)
  33. 6-第 6 档(80%)
  34. 7-第 7 档(全开)
  35. */
  36. BypassValve int `json:"bypass_valve"` // 旁通阀
  37. SetInletWaterPre float32 `json:"set_inlet_water_pre"` // 设定出水压力值
  38. SetMaxDifferencePre float32 `json:"set_max_difference_pre"` // 设定最大压差值
  39. SetMinDifferencePre float32 `json:"set_min_difference_pre"` // 设定最小压差值
  40. HeaderMode int `json:"header_mode"` // 模式 0-手动; 1-自动; 2-调试;
  41. PrimaryPumpStatus int `json:"primary_pump_status"` // 一级泵运行状态 0-关闭; 1-打开;
  42. SecondaryPumpStatus int `json:"secondary_pump_status"` // 二级泵运行状态 0-关闭; 1-打开;
  43. PrimaryPumpFrequency float32 `json:"primary_pump_frequency"` // 一级泵运行频率
  44. SecondaryPumpFrequency float32 `json:"secondary_pump_frequency"` // 二级泵运行频率
  45. WetNodeInput1 int `json:"wet_node_input_1"` // 湿节点信号输入1 0-断开; 1-闭合;
  46. WetNodeInput2 int `json:"wet_node_input_2"` // 湿节点信号输入2 0-断开; 1-闭合;
  47. WetNodeInput int `json:"wet_node_input"` // 湿节点信号输入 0-断开; 1-闭合;
  48. DryNodeInput int `json:"dry_node_input"` // 干节点信号输入 0-断开; 1-闭合;
  49. PrimaryOutletTemp float32 `json:"primary_outlet_temp"` // 一级出水温度
  50. PrimaryReturnTemp float32 `json:"primary_return_temp"` // 一级回水温度
  51. SecondaryOutletTemp float32 `json:"secondary_outlet_temp"` // 二级出水温度
  52. SecondaryReturnTemp float32 `json:"secondary_return_temp"` // 二级回水温度
  53. }
  54. type WaterCollector struct {
  55. CollectorPower int `json:"collector_power"` // 开关机设定
  56. PumpStationPower int `json:"pump_station_power"` // 泵站开关设定
  57. DeviceReset int `json:"device_reset"` // 设备软件复位
  58. CollectorMode int `json:"collector_mode"` // 模式
  59. SetTargetOutletPressure float32 `json:"set_target_outlet_pressure"` // 目标出水压力设定
  60. SetMaxiPressureDifference float32 `json:"set_maxi_pressure_difference"` // 最大压差设定
  61. SetMiniPressureDifference float32 `json:"set_mini_pressure_difference"` // 最小压差设定
  62. SetBypassPipeDiameter int `json:"set_bypass_pipe_diameter"` // 旁通管径设定 0 表征 25 管径; 1 表征 50 管径; 2 表征 32 管径;注:出厂已配置完成
  63. FillValvePower int `json:"fill_valve_power"` // 补水阀开关 0-关闭; 1-打开
  64. PrimaryPumpTypeConf int `json:"primary_pump_type_conf"` // 一级泵类型配置 0-定频泵;(出厂默认) 1-PWM 变频泵(定流量); 2-PWM 变频泵(变流量); 3-0-10V 变频泵(定流量); 4-0-10V 变频泵(变流量);
  65. SecondaryPumpTypeConf int `json:"secondary_pump_type_conf"` // 二级泵类型配置 0-定频泵; 1-PWM 变频泵(定流量); 2-PWM 变频泵(变流量);(出厂默认) 3-0-10V 变频泵(定流量); 4-0-10V 变频泵(变流量)
  66. PrimaryPumpControlMethod int `json:"primary_pump_control_method"` // 一级泵控制方式 0-恒压控制; 1-温差控制
  67. SecondaryPumpControlMethod int `json:"secondary_pump_control_method"` // 二级泵控制方式 0-恒压控制; 1-温差控制
  68. SetPrimaryPumpConstantPressure float32 `json:"set_primary_pump_constant_pressure"` // 一级泵恒压设定值
  69. SetSecondaryPumpConstantPressure float32 `json:"set_secondary_pump_constant_pressure"` // 二级泵恒压设定值
  70. SetPrimaryPumpConstantTempDifference float32 `json:"set_primary_pump_constant_temp_difference"` // 一级泵恒温差设定值
  71. SetSecondaryPumpConstantTempDifference float32 `json:"set_secondary_pump_constant_temp_difference"` // 二级泵恒温差设定值
  72. PrimaryPumpFrequencyLowerLimit float32 `json:"primary_pump_frequency_lower_limit"` // 一级泵泵频率下限
  73. PrimaryPumpFrequencyUpperLimit float32 `json:"primary_pump_frequency_upper_limit"` // 一级泵泵频率上限
  74. PumpPWMControlTypeConf int `json:"pump_pwm_control_type_conf"` // 泵 PWM 控类型配置 0-表征正序; 1-表征逆序
  75. SecondaryPumpFrequencyLowerLimit float32 `json:"secondary_pump_frequency_lower_limit"` // 二级泵泵频率下限
  76. SecondaryPumpFrequencyUpperLimit float32 `json:"secondary_pump_frequency_upper_limit"` // 二级泵泵频率上限
  77. AntiJammingFunction int `json:"anti_jamming_function"` // 防卡功能
  78. /*
  79. 0-第 0 档(全关)
  80. 1-第 1 档(30%)
  81. 2-第 2 挡(40%)
  82. 3-第 3 挡(50%)
  83. 4-第 4 挡(60%)
  84. 5-第 5 挡(70%)
  85. 6-第 6 档(80%)
  86. 7-第 7 档(全开)
  87. */
  88. BypassValvePower int `json:"bypass_valve_power"` // 旁通阀手动开关
  89. OperatingMode int `json:"operating_mode"` // 运行方式 0-单品联动;(出厂默认) 1-管家联动;
  90. }
  91. type OutdoorUnit struct {
  92. OutdoorMode int `json:"outdoor_mode"` // 工作模式(1制冷 2制热)
  93. RefrigerationWaterTemp float32 `json:"refrigeration_water_temp"` // 制冷水温设置温度
  94. HeatingWaterTemp float32 `json:"heating_water_temp"` // 制热水温设置温度
  95. OutdoorCirculationTemp float32 `json:"outdoor_circulation_temp"` // 室外循环温度
  96. InletWaterTemp float32 `json:"inlet_water_temp"` // 出水温度
  97. OutletWaterTemp float32 `json:"outlet_water_temp"` // 进水温度
  98. OutdoorPower int `json:"outdoor_power"` // 开关机 (1开 0关)
  99. Auxiliary int `json:"auxiliary"` // 辅热开关 (1开 0关)
  100. FaultMark int `json:"fault_mark"` // 故障标志
  101. }
  102. type TempControlCenter struct {
  103. PrimaryInletTemp float32 `json:"primary_inlet_temp"` // 一级进水温度
  104. PrimaryOutletTemp float32 `json:"primary_outlet_temp"` // 一级出水温度
  105. SecondaryInletTemp float32 `json:"secondary_inlet_temp"` // 二级进水温度
  106. SecondaryOutletTemp float32 `json:"secondary_outlet_temp"` // 二级出水温度
  107. DewPointTemp float32 `json:"dew_point_temp"` // 环境露点温度
  108. Mode int `json:"mode"` // 模式
  109. }
  110. type ControlArgs struct {
  111. Address int `json:"address"`
  112. Value interface{} `json:"value"`
  113. }
  114. func GetConfig(key string) *g.Var {
  115. ret, err := g.Cfg().Get(context.Background(), key)
  116. if err != nil {
  117. }
  118. return ret
  119. }