123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- package com.hb.proj.gather.protocol;
- /**
- * 数据读取指令 枚举类
- * @author cwen
- *
- */
- public enum ZLOpdProtCMDEnum {
-
- //20[应返回数据区字节数] 一次读取到油压、套压、回压、井口温度、载荷 01 03 01 2c 00 0a 校验位两字节 应返回字节数 每个数据项字节数 参数编码表
- PRESS_TEMP_LOAD(
- new byte[] {0x01, 0x03, 0x01, 0x2c, 0x00, 0x0a, 0x05, (byte)0xf8},
- 0x14,
- 4,
- new String[]{"oil_press","casing_press","back_press","well_head_temp","load"}),
-
-
-
- //48 电机电流A、B、C,电压A、B、C,有功功耗,无功功耗,有功功率,无功功率,反向功率,功率因数 01 03 01 5f 00 18
- CURR_VOL_LOS_PW(
- new byte[] {0x01, 0x03, 0x01, 0x5f, 0x00, 0x18, 0x74, (byte)0x2e},
- 0x30,
- 4,
- 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"}),
-
- //8 冲次、冲程 01 03 01 a4 00 04
- FREQ_STROKE(
- new byte[] {0x01, 0x03, 0x01, (byte)0xa4, 0x00, 0x04, 0x04, 0x16},
- 0x08,
- 4,
- new String[]{"freq","stroke"}),
-
- //2 功图实际点数 01 03 03 d7 00 01
- DIAGRAM_POINT_COUNT(
- new byte[] {0x01, 0x03, 0x03, (byte)0xd7, 0x00, 0x01, 0x34, 0x76},
- 0x02,
- 2,
- new String[]{"diagram_point"}),
-
-
-
-
- //200-100 功图位移第1部分 01 03 03 e8 00 64
- DIAGRAM_DISP_1(
- new byte[] {0x01, 0x03, 0x03, (byte)0xe8, 0x00, 0x64, (byte)0xc4, 0x51},
- 0xc8,
- 2,
- new String[]{"disp_1"}),
-
- //200-100 功图位移第2部分 01 03 04 4c 00 64
- DIAGRAM_DISP_2(
- new byte[] {0x01, 0x03, 0x04, 0x4c, 0x00, 0x64, (byte)0x84, (byte)0xc6},
- 0xc8,
- 2,
- new String[]{"disp_2"}),
-
- //100-50 功图位移第3部分 01 03 04 b0 00 32
- DIAGRAM_DISP_3(
- new byte[] {0x01, 0x03, 0x04, (byte)0xb0, 0x00, 0x32, (byte)0xc4, (byte)0xc8},
- 0x64,
- 2,
- new String[]{"disp_3"}),
-
-
-
-
- //200-100 功图载荷第1部分 01 03 04 e2 00 64
- DIAGRAM_LOAD_1(
- new byte[] {0x01, 0x03, 0x04, (byte)0xe2, 0x00, 0x64, (byte)0xe5, 0x27},
- 0xc8,
- 2,
- new String[]{"chartload_1"}),
-
- //200-100 功图载荷第2部分 01 03 05 46 00 64
- DIAGRAM_LOAD_2(
- new byte[] {0x01, 0x03, 0x05, 0x46, 0x00, 0x64, (byte)0xa5, 0x38},
- 0xc8,
- 2,
- new String[]{"chartload_2"}),
-
- //100-50 功图载荷第3部分 01 03 05 aa 00 32
- DIAGRAM_LOAD_3(
- new byte[] {0x01, 0x03, 0x05, (byte)0xaa, 0x00, 0x32, (byte)0xe4, (byte)0xf3},
- 0x64,
- 2,
- new String[]{"chartload_3"}),
-
-
-
-
-
-
- //200-100 电流图电流第1部分 01 03 05 dc 00 64
- DIAGRAM_CURR_1(
- new byte[] {0x01, 0x03, 0x05, (byte)0xdc, 0x00, 0x64, (byte)0x85, 0x17},
- 0xc8,
- 2,
- new String[]{"chartcurr_1"}),
-
- //200-100 电流图电流第2部分 01 03 06 40 00 64
- DIAGRAM_CURR_2(
- new byte[] {0x01, 0x03, 0x06, 0x40, 0x00, 0x64, 0x45, 0x7d},
- 0xc8,
- 2,
- new String[]{"chartcurr_2"}),
-
- //100-50 电流图电流第3部分 01 03 06 a4 00 32
- DIAGRAM_CURR_3(
- new byte[] {0x01, 0x03, 0x06, (byte)0xa4, 0x00, 0x32, (byte)0x85, (byte)0x74},
- 0x64,
- 2,
- new String[]{"chartcurr_3"}),
-
-
-
-
-
- //200-100 功率图功率第1部分 01 03 06 d6 00 64
- DIAGRAM_POWER_1(
- new byte[] {0x01, 0x03, 0x06, (byte)0xd6, 0x00, 0x64, (byte)0xa5, 0x51},
- 0xc8,
- 2,
- new String[]{"chartpower_1"}),
-
- //200-100 功率图功率第2部分 01 03 07 3a 00 64
- DIAGRAM_POWER_2(
- new byte[] {0x01, 0x03, 0x07, 0x3a, 0x00, 0x64, 0x65, 0x58},
- 0xc8,
- 2,
- new String[]{"chartpower_2"}),
-
- //100-50 功率图功率第3部分 01 03 07 e9 00 32
- DIAGRAM_POWER_3(
- new byte[] {0x01, 0x03, 0x07, (byte)0xe9, 0x00, 0x32, 0x14, (byte)0x9f},
- 0x64,
- 2,
- new String[]{"chartpower_3"})
- ;
-
- private byte[] cmd; //读取指令 最后字节CRC16
-
- private int totalBytCount; //返回的字节数(以此区分不同指令的返回数据)
-
- private int itemBytCount; //每个数据项字节数 目前为4字节或2字节一个数据
-
- private String[] paramCodes; //返回数据项对应参数编码
-
- private ZLOpdProtCMDEnum(byte[] cmd,int totalBytCount,int itemBytCount,String[] paramCodes) {
- this.cmd=cmd;
- this.totalBytCount=totalBytCount;
- this.itemBytCount=itemBytCount;
- this.paramCodes=paramCodes;
- }
- public byte[] getCmd() {
- return cmd;
- }
- public int getTotalBytCount() {
- return totalBytCount;
- }
- public int getItemBytCount() {
- return itemBytCount;
- }
- public String[] getParamCodes() {
- return paramCodes;
- }
-
- }
|