ZLOpdProtCMDEnum.java 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. package com.hb.proj.gather.protocol;
  2. /**
  3. * 数据读取指令 枚举类
  4. * @author cwen
  5. *
  6. */
  7. public enum ZLOpdProtCMDEnum {
  8. //20[应返回数据区字节数] 一次读取到油压、套压、回压、井口温度、载荷 01 03 01 2c 00 0a 校验位两字节 应返回字节数 每个数据项字节数 参数编码表
  9. PRESS_TEMP_LOAD(
  10. new byte[] {0x01, 0x03, 0x01, 0x2c, 0x00, 0x0a, 0x05, (byte)0xf8},
  11. 0x14,
  12. 4,
  13. new String[]{"oil_press","casing_press","back_press","well_head_temp","load"}),
  14. //48 电机电流A、B、C,电压A、B、C,有功功耗,无功功耗,有功功率,无功功率,反向功率,功率因数 01 03 01 5f 00 18
  15. CURR_VOL_LOS_PW(
  16. new byte[] {0x01, 0x03, 0x01, 0x5f, 0x00, 0x18, 0x74, (byte)0x2e},
  17. 0x30,
  18. 4,
  19. new String[]{"current_a","current_b","current_c","voltage_a","voltage_b","voltage_c","useful_power_loss","unuseful_power_loss","useful_power","unuseful_power","reverse_power","power_factor"}),
  20. //8 冲次、冲程 01 03 01 a4 00 04
  21. FREQ_STROKE(
  22. new byte[] {0x01, 0x03, 0x01, (byte)0xa4, 0x00, 0x04, 0x04, 0x16},
  23. 0x08,
  24. 4,
  25. new String[]{"freq","stroke"}),
  26. //2 功图实际点数 01 03 03 d7 00 01
  27. DIAGRAM_POINT_COUNT(
  28. new byte[] {0x01, 0x03, 0x03, (byte)0xd7, 0x00, 0x01, 0x34, 0x76},
  29. 0x02,
  30. 2,
  31. new String[]{"diagram_point"}),
  32. //200-100 功图位移第1部分 01 03 03 e8 00 64
  33. DIAGRAM_DISP_1(
  34. new byte[] {0x01, 0x03, 0x03, (byte)0xe8, 0x00, 0x64, (byte)0xc4, 0x51},
  35. 0xc8,
  36. 2,
  37. new String[]{"disp_1"}),
  38. //200-100 功图位移第2部分 01 03 04 4c 00 64
  39. DIAGRAM_DISP_2(
  40. new byte[] {0x01, 0x03, 0x04, 0x4c, 0x00, 0x64, (byte)0x84, (byte)0xc6},
  41. 0xc8,
  42. 2,
  43. new String[]{"disp_2"}),
  44. //100-50 功图位移第3部分 01 03 04 b0 00 32
  45. DIAGRAM_DISP_3(
  46. new byte[] {0x01, 0x03, 0x04, (byte)0xb0, 0x00, 0x32, (byte)0xc4, (byte)0xc8},
  47. 0x64,
  48. 2,
  49. new String[]{"disp_3"}),
  50. //200-100 功图载荷第1部分 01 03 04 e2 00 64
  51. DIAGRAM_LOAD_1(
  52. new byte[] {0x01, 0x03, 0x04, (byte)0xe2, 0x00, 0x64, (byte)0xe5, 0x27},
  53. 0xc8,
  54. 2,
  55. new String[]{"chartload_1"}),
  56. //200-100 功图载荷第2部分 01 03 05 46 00 64
  57. DIAGRAM_LOAD_2(
  58. new byte[] {0x01, 0x03, 0x05, 0x46, 0x00, 0x64, (byte)0xa5, 0x38},
  59. 0xc8,
  60. 2,
  61. new String[]{"chartload_2"}),
  62. //100-50 功图载荷第3部分 01 03 05 aa 00 32
  63. DIAGRAM_LOAD_3(
  64. new byte[] {0x01, 0x03, 0x05, (byte)0xaa, 0x00, 0x32, (byte)0xe4, (byte)0xf3},
  65. 0x64,
  66. 2,
  67. new String[]{"chartload_3"}),
  68. //200-100 电流图电流第1部分 01 03 05 dc 00 64
  69. DIAGRAM_CURR_1(
  70. new byte[] {0x01, 0x03, 0x05, (byte)0xdc, 0x00, 0x64, (byte)0x85, 0x17},
  71. 0xc8,
  72. 2,
  73. new String[]{"chartcurr_1"}),
  74. //200-100 电流图电流第2部分 01 03 06 40 00 64
  75. DIAGRAM_CURR_2(
  76. new byte[] {0x01, 0x03, 0x06, 0x40, 0x00, 0x64, 0x45, 0x7d},
  77. 0xc8,
  78. 2,
  79. new String[]{"chartcurr_2"}),
  80. //100-50 电流图电流第3部分 01 03 06 a4 00 32
  81. DIAGRAM_CURR_3(
  82. new byte[] {0x01, 0x03, 0x06, (byte)0xa4, 0x00, 0x32, (byte)0x85, (byte)0x74},
  83. 0x64,
  84. 2,
  85. new String[]{"chartcurr_3"}),
  86. //200-100 功率图功率第1部分 01 03 06 d6 00 64
  87. DIAGRAM_POWER_1(
  88. new byte[] {0x01, 0x03, 0x06, (byte)0xd6, 0x00, 0x64, (byte)0xa5, 0x51},
  89. 0xc8,
  90. 2,
  91. new String[]{"chartpower_1"}),
  92. //200-100 功率图功率第2部分 01 03 07 3a 00 64
  93. DIAGRAM_POWER_2(
  94. new byte[] {0x01, 0x03, 0x07, 0x3a, 0x00, 0x64, 0x65, 0x58},
  95. 0xc8,
  96. 2,
  97. new String[]{"chartpower_2"}),
  98. //100-50 功率图功率第3部分 01 03 07 e9 00 32
  99. DIAGRAM_POWER_3(
  100. new byte[] {0x01, 0x03, 0x07, (byte)0xe9, 0x00, 0x32, 0x14, (byte)0x9f},
  101. 0x64,
  102. 2,
  103. new String[]{"chartpower_3"})
  104. ;
  105. private byte[] cmd; //读取指令 最后字节CRC16
  106. private int totalBytCount; //返回的字节数(以此区分不同指令的返回数据)
  107. private int itemBytCount; //每个数据项字节数 目前为4字节或2字节一个数据
  108. private String[] paramCodes; //返回数据项对应参数编码
  109. private ZLOpdProtCMDEnum(byte[] cmd,int totalBytCount,int itemBytCount,String[] paramCodes) {
  110. this.cmd=cmd;
  111. this.totalBytCount=totalBytCount;
  112. this.itemBytCount=itemBytCount;
  113. this.paramCodes=paramCodes;
  114. }
  115. public byte[] getCmd() {
  116. return cmd;
  117. }
  118. public int getTotalBytCount() {
  119. return totalBytCount;
  120. }
  121. public int getItemBytCount() {
  122. return itemBytCount;
  123. }
  124. public String[] getParamCodes() {
  125. return paramCodes;
  126. }
  127. }