9度通讯程序适用于9度多组设备
Administrator
2023-12-27 c736aaea5522e295b42676f094d313e7f6a4afb4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
package com.dev.fbs9009;
 
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Date;
 
import com.base.Com;
import com.base.ComBase;
import com.dev.modbus4j.MyModbusMaster;
import com.dev.modbus4j.MyModbusUtils;
import com.serotonin.modbus4j.BatchRead;
import com.serotonin.modbus4j.BatchResults;
import com.serotonin.modbus4j.code.DataType;
 
public class LD_sys_state {
    public static int BYTE_LEN=26;       //¼Ä´æÆ÷¸öÊý
    private int cmd;                     //·¢ËÍÊý¾ÝµÄÃüÁî
    private int cmd_addr;                 //·¢ËÍÊý¾ÝÃüÁîµÄÆðʼµØÖ·
    private int cmd_addr_back;             //½ÓÊÕÊý¾ÝµÄ¼Ä´æÆ÷µÄÆðʼµØÖ·
    private int dataCount;                 //Êý¾ÝµÄ³¤¶È
    
    private int sys_state;               //¹¤×÷״̬
    private double sys_online_vol;       //ÔÚÏßµçѹ0.01
    private double sys_group_vol;        //×é¶Ëµçѹ0.01
    
    private int sys_now_battnum;         //µ±Ç°µç³ØÐòºÅ
    private int sys_now_battstate;       //µ±Ç°µç³Ø×´Ì¬
    private double sys_now_battvol;      //µ±Ç°µç³Øµçѹ0.001
    private double sys_now_battcurr;     //µ±Ç°µç³ØµçÁ÷0.001
    private double sys_now_battcap;      //µ±Ç°µç³Ø²âÊÔÈÝÁ¿0.01
    private int sys_now_testtime_hour;   //µ±Ç°µç³Ø²âÊÔʱ¼ä-H
    private int sys_now_testtime_minute; //µ±Ç°µç³Ø²âÊÔʱ¼ä-M
    private int sys_now_testtime_second; //µ±Ç°µç³Ø²âÊÔʱ¼ä-S
    
    private int sys_next_battnum;        //ÏÂÒ»½Úµç³ØÐòºÅ
    private int sys_next_battstate;      //ÏÂÒ»½Úµç³Ø×´Ì¬
    private double sys_next_battvol;     //ÏÂÒ»½Úµç³Øµçѹ0.001
    private double sys_next_battcurr;    //ÏÂÒ»½Úµç³ØµçÁ÷0.001
    private double sys_next_battcap;     //ÏÂÒ»½Úµç³ØÈÝÁ¿0.01
    private int sys_next_testtime_hour;  //ÏÂÒ»½Úµç³Ø²âÊÔʱ¼ä-H
    private int sys_next_testtime_minute;//ÏÂÒ»½Úµç³Ø²âÊÔʱ¼ä-M
    private int sys_next_testtime_second;//ÏÂÒ»½Úµç³Ø²âÊÔʱ¼ä-S
    
    private double sys_tmp;              //ζÈ0.1
    private int sys_stop_reason;          //Í£Ö¹Ô­Òò
    private int mon_vol_hight_alarm;    //µ¥Ìåµçѹ¸ß¸æ¾¯
    private int mon_vol_lower_alarm;    //µ¥ÌåµçѹµÍ¸æ¾¯
    private int mon_cap_alarm;            //ÈÝÁ¿¸æ¾¯
    private int mon_tmp_alarm;            //ζȸ澯
    private int mon_res_alarm;            //ÄÚ×è¸æ¾¯
    
    private int test_mon_num = 0;
    private boolean isNewRecord = true;                                //ÊÇ·ñÊÇеIJâÊÔÊý¾Ý
    private int record_num = 1;                                        //¼Ç¼µ±Ç°¼Ç¼µÄÌõÊý
    private int test_record_count;                                    //µ±Ç°²âÊÔ±ÊÊý
    private Date test_starttime =  new Date(2000,0,1);                //µ±Ç°µç³Ø×é²âÊÔµÄÆðʼʱ¼ä
    private Date record_historytime = new Date(2000,0,1);            //¼Ç¼ÀúÊ·Êý¾ÝµÄʱ¼ä
    private long test_timelong = 0;
    
     //»ñȡϵͳÐÅÏ¢ºÍµç³ØÐÅÏ¢
      public boolean setLD_sys_state(ByteBuffer bf){    
          boolean flag = false;
          ByteBuffer tmpbuf = bf;    
          //System.out.println("pos:"+bf.position()+"\tlimit:"+bf.limit()+"\tcap"+bf.capacity());
          tmpbuf.position(0);        
          try {
              this.cmd_addr = ComBase.changeByteToInt(tmpbuf.get());                    //»ñÈ¡É豸µØÖ·
              this.cmd = ComBase.changeByteToInt(tmpbuf.get());
              this.cmd_addr_back =  ComBase.changeShortToInt(tmpbuf.getShort());
              //this.dataCount = ComBase.changeByteToInt(tmpbuf.get());                //Êý¾ÝÇø×Ö½ÚÊý        
              this.dataCount = ComBase.changeByteToInt(tmpbuf.get());
              //System.out.println("Êý¾ÝÇø×Ö½ÚÊýµÄ³¤¶È:"+this.dataCount);
              
              this.sys_state=ComBase.changeShortToInt(tmpbuf.getShort());
              //this.sys_state = 1;
              
              this.sys_online_vol=ComBase.changeShortToDouble(tmpbuf.getShort())*0.01;
              this.sys_group_vol=ComBase.changeShortToDouble(tmpbuf.getShort())*0.01;
              
              this.sys_now_battnum=ComBase.changeShortToInt(tmpbuf.getShort());
              this.sys_now_battstate=ComBase.changeShortToInt(tmpbuf.getShort());
              this.sys_now_battvol=ComBase.changeShortToDouble(tmpbuf.getShort())*0.001;
              this.sys_now_battcurr=ComBase.changeShortToDouble(tmpbuf.getShort())*0.001;
              this.sys_now_battcap=ComBase.changeShortToDouble(tmpbuf.getShort())*0.01;
              this.sys_now_testtime_hour=ComBase.changeShortToInt(tmpbuf.getShort());
              this.sys_now_testtime_minute=ComBase.changeShortToInt(tmpbuf.getShort());
              this.sys_now_testtime_second=ComBase.changeShortToInt(tmpbuf.getShort());
              
              this.sys_next_battnum=ComBase.changeShortToInt(tmpbuf.getShort());
              this.sys_next_battstate=ComBase.changeShortToInt(tmpbuf.getShort());
              this.sys_next_battvol=ComBase.changeShortToDouble(tmpbuf.getShort())*0.001;
              this.sys_next_battcurr=ComBase.changeShortToDouble(tmpbuf.getShort())*0.001;
              this.sys_next_battcap=ComBase.changeShortToDouble(tmpbuf.getShort())*0.01;
              this.sys_next_testtime_hour=ComBase.changeShortToInt(tmpbuf.getShort());
              this.sys_next_testtime_minute=ComBase.changeShortToInt(tmpbuf.getShort());
              this.sys_next_testtime_second=ComBase.changeShortToInt(tmpbuf.getShort());
              
              this.sys_tmp=ComBase.changeShortToDouble(tmpbuf.getShort())*0.1;
              this.sys_stop_reason=ComBase.changeShortToInt(tmpbuf.getShort());
              this.mon_vol_hight_alarm = ComBase.changeShortToInt(tmpbuf.getShort());
              this.mon_vol_lower_alarm = ComBase.changeShortToInt(tmpbuf.getShort());
              this.mon_cap_alarm = ComBase.changeShortToInt(tmpbuf.getShort());
              this.mon_tmp_alarm = ComBase.changeShortToInt(tmpbuf.getShort());
              this.mon_res_alarm = ComBase.changeShortToInt(tmpbuf.getShort());
                      
              flag = true;
          } catch (Exception e) {
              e.printStackTrace();
          }                
          return flag;
      }
      
      //»ñÈ¡µ±Ç°ÕýÔڷŵçµÄµç³Ø×éµ¥Ìå±àºÅ
      public int getNowTestMonNum(){
          int mon_num = 0;
          if(this.sys_state == MyModBusCom.SYS_STATE_HRTEST){
              if(sys_now_battstate == MyModBusCom.BATT_DISCHARGE){
                  mon_num = this.sys_now_battnum;
              }else if(sys_next_battstate == MyModBusCom.BATT_DISCHARGE){
                  mon_num = this.sys_next_battnum;
              }
          }
          return mon_num;
      }
      
      //»ñÈ¡ÕýÔÚºËÈݲâÊԵĹý³ÌÖеĵçÁ÷
      public double getNowTestCurr(){
          double test_curr = 0.0;
          if(this.sys_state == MyModBusCom.SYS_STATE_HRTEST){
              if(sys_now_battstate == MyModBusCom.BATT_DISCHARGE){
                  test_curr = this.sys_now_battcurr;
              }else if(sys_next_battstate == MyModBusCom.BATT_DISCHARGE){
                  test_curr = this.sys_next_battcurr;
              }
          }
          return test_curr;
      }
      
      //»ñÈ¡µ±Ç°µ¥ÌåºËÈݲâÊÔ¹ý³ÌÖеIJâÊÔÈÝÁ¿
      public double getNowTestCap(){
          double test_cap = 0.0;
          if(this.sys_state == MyModBusCom.SYS_STATE_HRTEST){
              if(sys_now_battstate == MyModBusCom.BATT_DISCHARGE){
                  test_cap = this.sys_now_battcap;
              }else if(sys_next_battstate == MyModBusCom.BATT_DISCHARGE){
                  test_cap = this.sys_next_battcap;
              }
          }
          return test_cap;
      }
      
    //»ñÈ¡µ±Ç°µ¥ÌåºËÈݲâÊÔ¹ý³ÌÖе¥Ìåµçѹ
      public double getNowMonVol(){
          double monnum_vol = 0.0;
          if(this.sys_state == MyModBusCom.SYS_STATE_HRTEST){
              if(sys_now_battstate == MyModBusCom.BATT_DISCHARGE){
                  monnum_vol = this.sys_now_battvol;
              }else if(sys_next_battstate == MyModBusCom.BATT_DISCHARGE){
                  monnum_vol = this.sys_next_battvol;
              }
          }
          return monnum_vol;
      }
      
      /**
       * »ñÈ¡µ±Ç°µç³ØµÄ״̬
       */
      public int getNowBattType(){
          int batttype = 1;
          if(this.sys_now_battstate == MyModBusCom.BATT_CHARGE || this.sys_next_battstate == MyModBusCom.BATT_CHARGE){
              batttype = 2;
          }
          if(this.sys_state == MyModBusCom.SYS_STATE_HRTEST){
              if(this.sys_now_battstate == MyModBusCom.BATT_DISCHARGE || this.sys_next_battstate == MyModBusCom.BATT_DISCHARGE){
                  batttype = 3;        //ÔÆÆ½Ì¨¶ÔÓ¦µÄ·Åµç״̬
              }
          }
          return batttype;
      }
      
      /**
       * »ñÈ¡µ±Ç°µç³ØµÄ²âÊÔʱ¼ä
       * @return
       */
      public String getSys_now_testtime(){
          String ymd = Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms);
          //ymd += " "+this.sys_now_testtime_hour+":"+this.sys_now_testtime_minute+":"+this.sys_now_testtime_second;
          return ymd;
      }
      
      /**
       * »ñÈ¡ÏÂÒ»×éµç³ØµÄ²âÊÔʱ¼ä
       * @return
       */
      public String getSys_next_testtime(){
          String ymd = Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms);
          //ymd += " "+this.sys_next_testtime_hour+":"+this.sys_next_testtime_minute+":"+this.sys_next_testtime_second;
          return ymd;
      }
      
      /**
       * ´Óϵͳ״̬ϵͳÖлñÈ¡µç³Ø×éµÄ²âÊÔµçÁ÷
       * @return
       */
      public double getBattTestCurr(){
          double test_curr = 0;
          if(this.sys_now_battstate == MyModBusCom.BATT_CHARGE){
              test_curr = this.sys_now_battcurr;
          }else if(this.sys_next_battstate == MyModBusCom.BATT_CHARGE){
              test_curr = this.sys_now_battcurr;
          }
          if(this.sys_now_battstate == MyModBusCom.BATT_DISCHARGE){
              test_curr = this.sys_now_battcurr;
          }else if(this.sys_next_battstate == MyModBusCom.BATT_DISCHARGE){
              test_curr = this.sys_next_battcurr;
          }          
          return test_curr;
      }
      
      /**
       * ´Óϵͳ״̬ϵͳÖлñÈ¡µç³Ø×éµÄ²âÊÔÈÝÁ¿
       * @return
       */
      public double getBattTestCap(){
          double test_cap = 0;
          if(this.sys_now_battstate == MyModBusCom.BATT_DISCHARGE){
              test_cap = this.sys_now_battcap;
          }else if(this.sys_next_battstate == MyModBusCom.BATT_DISCHARGE){
              test_cap = this.sys_next_battcap;
          }          
          return test_cap;
      }
      
      public double getBattTestMonVol() {
          double test_monvol = 0;
          if(this.sys_now_battstate == MyModBusCom.BATT_DISCHARGE){
              test_monvol = this.sys_now_battvol;
          }else if(this.sys_next_battstate == MyModBusCom.BATT_DISCHARGE){
              test_monvol = this.sys_next_battvol;
          }else {
              test_monvol = this.sys_now_battvol;
          }
          return test_monvol;
      }
      
    public int getCmd() {
        return cmd;
    }
    public void setCmd(int cmd) {
        this.cmd = cmd;
    }
    public int getCmd_addr() {
        return cmd_addr;
    }
    public void setCmd_addr(int cmd_addr) {
        this.cmd_addr = cmd_addr;
    }
    public int getDataCount() {
        return dataCount;
    }
    public void setDataCount(int dataCount) {
        this.dataCount = dataCount;
    }
    public int getSys_state() {
        return sys_state;
    }
    public void setSys_state(int sys_state) {
        this.sys_state = sys_state;
    }
    public double getSys_online_vol() {
        return sys_online_vol;
    }
    public void setSys_online_vol(double sys_online_vol) {
        this.sys_online_vol = sys_online_vol;
    }
    public double getSys_group_vol() {
        return sys_group_vol;
    }
    public void setSys_group_vol(double sys_group_vol) {
        this.sys_group_vol = sys_group_vol;
    }
    public int getSys_now_battnum() {
        return sys_now_battnum;
    }
    public void setSys_now_battnum(int sys_now_battnum) {
        this.sys_now_battnum = sys_now_battnum;
    }
    public int getSys_now_battstate() {
        return sys_now_battstate;
    }
    public void setSys_now_battstate(int sys_now_battstate) {
        this.sys_now_battstate = sys_now_battstate;
    }
    public double getSys_now_battvol() {
        return sys_now_battvol;
    }
    public void setSys_now_battvol(double sys_now_battvol) {
        this.sys_now_battvol = sys_now_battvol;
    }
    public double getSys_now_battcurr() {
        return sys_now_battcurr;
    }
    public void setSys_now_battcurr(double sys_now_battcurr) {
        this.sys_now_battcurr = sys_now_battcurr;
    }
    public double getSys_now_battcap() {
        return sys_now_battcap;
    }
    public void setSys_now_battcap(double sys_now_battcap) {
        this.sys_now_battcap = sys_now_battcap;
    }
    public int getSys_now_testtime_hour() {
        return sys_now_testtime_hour;
    }
    public void setSys_now_testtime_hour(int sys_now_testtime_hour) {
        this.sys_now_testtime_hour = sys_now_testtime_hour;
    }
    public int getSys_now_testtime_minute() {
        return sys_now_testtime_minute;
    }
    public void setSys_now_testtime_minute(int sys_now_testtime_minute) {
        this.sys_now_testtime_minute = sys_now_testtime_minute;
    }
    public int getSys_now_testtime_second() {
        return sys_now_testtime_second;
    }
    public void setSys_now_testtime_second(int sys_now_testtime_second) {
        this.sys_now_testtime_second = sys_now_testtime_second;
    }
    public int getSys_next_battnum() {
        return sys_next_battnum;
    }
    public void setSys_next_battnum(int sys_next_battnum) {
        this.sys_next_battnum = sys_next_battnum;
    }
    public int getSys_next_battstate() {
        return sys_next_battstate;
    }
    public void setSys_next_battstate(int sys_next_battstate) {
        this.sys_next_battstate = sys_next_battstate;
    }
    public double getSys_next_battvol() {
        return sys_next_battvol;
    }
    public void setSys_next_battvol(double sys_next_battvol) {
        this.sys_next_battvol = sys_next_battvol;
    }
    public double getSys_next_battcurr() {
        return sys_next_battcurr;
    }
    public void setSys_next_battcurr(double sys_next_battcurr) {
        this.sys_next_battcurr = sys_next_battcurr;
    }
    public double getSys_next_battcap() {
        return sys_next_battcap;
    }
    public void setSys_next_battcap(double sys_next_battcap) {
        this.sys_next_battcap = sys_next_battcap;
    }
    public int getSys_next_testtime_hour() {
        return sys_next_testtime_hour;
    }
    public void setSys_next_testtime_hour(int sys_next_testtime_hour) {
        this.sys_next_testtime_hour = sys_next_testtime_hour;
    }
    public int getSys_next_testtime_minute() {
        return sys_next_testtime_minute;
    }
    public void setSys_next_testtime_minute(int sys_next_testtime_minute) {
        this.sys_next_testtime_minute = sys_next_testtime_minute;
    }
    public int getSys_next_testtime_second() {
        return sys_next_testtime_second;
    }
    public void setSys_next_testtime_second(int sys_next_testtime_second) {
        this.sys_next_testtime_second = sys_next_testtime_second;
    }
    public double getSys_tmp() {
        return sys_tmp;
    }
    public void setSys_tmp(double sys_tmp) {
        this.sys_tmp = sys_tmp;
    }
    
    
    public int getSys_stop_reason() {
        return sys_stop_reason;
    }
    
    public void setSys_stop_reason(int sys_stop_reason) {
        this.sys_stop_reason = sys_stop_reason;
    }
    
    public int getMon_vol_hight_alarm() {
        return mon_vol_hight_alarm;
    }
 
    public void setMon_vol_hight_alarm(int mon_vol_hight_alarm) {
        this.mon_vol_hight_alarm = mon_vol_hight_alarm;
    }
 
    public int getMon_vol_lower_alarm() {
        return mon_vol_lower_alarm;
    }
 
    public void setMon_vol_lower_alarm(int mon_vol_lower_alarm) {
        this.mon_vol_lower_alarm = mon_vol_lower_alarm;
    }
 
    public int getMon_cap_alarm() {
        return mon_cap_alarm;
    }
 
    public void setMon_cap_alarm(int mon_cap_alarm) {
        this.mon_cap_alarm = mon_cap_alarm;
    }
 
    
    
    public int getRecord_num() {
        return record_num;
    }
 
    public Date getTest_starttime() {
        return test_starttime;
    }
 
    public Date getRecord_historytime() {
        return record_historytime;
    }
 
    public long getTest_timelong() {
        return test_timelong;
    }
 
    public void setRecord_num(int record_num) {
        this.record_num = record_num;
    }
 
    public void setTest_starttime(Date test_starttime) {
        this.test_starttime = test_starttime;
    }
 
    public void setRecord_historytime(Date record_historytime) {
        this.record_historytime = record_historytime;
        this.test_timelong = Math.abs((this.record_historytime.getTime()-this.test_starttime.getTime())/1000);
    }
 
    public void setTest_timelong(long test_timelong) {
        this.test_timelong = test_timelong;
    }
 
    
    
    public int getTest_record_count() {
        return test_record_count;
    }
 
    public void setTest_record_count(int test_record_count) {
        this.test_record_count = test_record_count;
    }
 
    public boolean isNewRecord() {
        return isNewRecord;
    }
 
    public void setNewRecord(boolean isNewRecord) {
        this.isNewRecord = isNewRecord;
    }
    
    public int getTest_mon_num() {
        return test_mon_num;
    }
 
    public void setTest_mon_num(int test_mon_num) {
        this.test_mon_num = test_mon_num;
    }
 
    @Override
    public String toString() {
        return "LD_sys_state [sys_state=" + sys_state + ", sys_online_vol=" + sys_online_vol + ", sys_group_vol="
                + sys_group_vol + ", sys_now_battnum=" + sys_now_battnum + ", sys_now_battstate=" + sys_now_battstate
                + ", sys_now_battvol=" + sys_now_battvol + ", sys_now_battcurr=" + sys_now_battcurr
                + ", sys_now_battcap=" + sys_now_battcap + ", sys_now_testtime_hour=" + sys_now_testtime_hour
                + ", sys_now_testtime_minute=" + sys_now_testtime_minute + ", sys_now_testtime_second="
                + sys_now_testtime_second + ", sys_next_battnum=" + sys_next_battnum + ", sys_next_battstate="
                + sys_next_battstate + ", sys_next_battvol=" + sys_next_battvol + ", sys_next_battcurr="
                + sys_next_battcurr + ", sys_next_battcap=" + sys_next_battcap + ", sys_next_testtime_hour="
                + sys_next_testtime_hour + ", sys_next_testtime_minute=" + sys_next_testtime_minute
                + ", sys_next_testtime_second=" + sys_next_testtime_second + ", sys_tmp=" + sys_tmp
                + ", sys_stop_reason=" + sys_stop_reason + ", mon_vol_hight_alarm=" + mon_vol_hight_alarm
                + ", mon_vol_lower_alarm=" + mon_vol_lower_alarm + ", mon_cap_alarm=" + mon_cap_alarm
                + ", mon_tmp_alarm=" + mon_tmp_alarm + ", mon_res_alarm=" + mon_res_alarm  + ", isNewRecord=" + isNewRecord
                + ", record_num=" + record_num + ", test_starttime=" + test_starttime + ", record_historytime="
                + record_historytime + ", test_timelong=" + test_timelong + "]";
    }
 
    public BatchRead<Integer> createLDSysStateBatchRead(MyModbusMaster master,int index) {
        int offset = MyModBusData.SYS_STATE_ADDR_INDEX[index];
        int count = 0;
        BatchRead<Integer> batch = new BatchRead<Integer>();
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++,DataType.TWO_BYTE_INT_UNSIGNED, master));        //¹¤×÷״̬                            
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //ÔÚÏßµçѹ                        
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //×é¶Ëµçѹ                    
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //µ±Ç°µç³ØÐòºÅ                            
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //µ±Ç°µç³Ø×´Ì¬                    
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //µ±Ç°µç³Øµçѹ                    
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //µ±Ç°µç³ØµçÁ÷                    
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //µ±Ç°µç³Ø²âÊÔÈÝÁ¿                
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //µ±Ç°µç³Ø²âÊÔʱ¼ä(H)                
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //µ±Ç°µç³Ø²âÊÔʱ¼ä(M)                
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //µ±Ç°µç³Ø²âÊÔʱ¼ä£¨S£©                
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //ÏÂÒ»½Úµç³ØÐòºÅ                            
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //ÏÂÒ»½Úµç³Ø×´Ì¬                    
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //ÏÂÒ»½Úµç³Øµçѹ                            
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //ÏÂÒ»½Úµç³ØµçÁ÷                            
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //ÏÂÒ»½Úµç³ØÈÝÁ¿                            
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //ÏÂÒ»½Úµç³Ø²âÊÔʱ¼ä£¨H£©                            
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //ÏÂÒ»½Úµç³Ø²âÊÔʱ¼ä£¨M£©                            
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //ÏÂÒ»½Úµç³Ø²âÊÔʱ¼ä£¨S£©                            
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //ζȠ                           
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //Í£Ö¹Ô­Òò                            
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //µ¥Ìåµçѹ¸ß¸æ¾¯                            
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //µ¥ÌåµçѹµÍ¸æ¾¯                    
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //ÈÝÁ¿¸æ¾¯                            
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //ζȸ澯                            
        batch.addLocator(count,MyModbusUtils.createBaseLocator(offset+count++, DataType.TWO_BYTE_INT_UNSIGNED, master));    //ÄÚ×è¸æ¾¯                            
        return batch;
    }
 
    public boolean putLDSysStateBatchResult(BatchResults<Integer> res) {
        if(null != res) {            
            this.sys_state = res.getIntValue(0);
              //this.sys_state = 1;              
              this.sys_online_vol = (double)res.getIntValue(1)*0.01;
              this.sys_group_vol = (double)res.getIntValue(2)*0.01;
              
              this.sys_now_battnum = res.getIntValue(3);
              this.sys_now_battstate = res.getIntValue(4);
              this.sys_now_battvol = (double)res.getIntValue(5)*0.001;
              this.sys_now_battcurr = (double)res.getIntValue(6)*0.001;
              this.sys_now_battcap = (double)res.getIntValue(7)*0.01;
              this.sys_now_testtime_hour = res.getIntValue(8);
              this.sys_now_testtime_minute = res.getIntValue(9);
              this.sys_now_testtime_second= res.getIntValue(10);
              
              this.sys_next_battnum = res.getIntValue(11);
              this.sys_next_battstate = res.getIntValue(12);
              this.sys_next_battvol = (double)res.getIntValue(13)*0.001;
              this.sys_next_battcurr = (double)res.getIntValue(14)*0.001;
              this.sys_next_battcap = (double)res.getIntValue(15)*0.01;
              this.sys_next_testtime_hour = res.getIntValue(16);
              this.sys_next_testtime_minute = res.getIntValue(17);
              this.sys_next_testtime_second = res.getIntValue(18);
              
              this.sys_tmp = (double)res.getIntValue(19)*0.1;
              this.sys_stop_reason = res.getIntValue(20);
              this.mon_vol_hight_alarm = res.getIntValue(21);
              this.mon_vol_lower_alarm = res.getIntValue(22);
              this.mon_cap_alarm = res.getIntValue(23);
              this.mon_tmp_alarm = res.getIntValue(24);
              this.mon_res_alarm = res.getIntValue(25);
            return true;
        }    
        return false;
    }
 
}