111
whyclj
2020-09-10 17abf30f43f493cb09904267e74ac51fd1ea96b1
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
package com.electrical.TwoKW;
 
import com.modbus.data.MyModbusMaster;
import com.modbus.data.MyModbusUtils;
import com.serotonin.modbus4j.BatchRead;
import com.serotonin.modbus4j.BatchResults;
import com.serotonin.modbus4j.code.DataType;
 
public class Electric_Control_Single_2kw {
    public int num ;                            //'Ö÷¼ü',
    public int electric2KW_id ;                    //'µçÔ´id',
  
    public int upper_pulse_block;                //ÉÏλ»úÂö³å·âËø
    public int remote_start;                    //Ô¶³ÌÆô¶¯
    public int fault_reset;                        //¹ÊÕϸ´Î»
    public int conscurrswitch;                    //ºãÁ÷Çл»
    public int constantvol;                        //4²¢»ò2´®2²¢ºãѹ
    public int volset_confirm;                    //µçѹ¸ø¶¨È·ÈÏ
    public int currset_confirm;                    //µçÁ÷¸ø¶¨È·ÈÏ
    public int remote_stop;                        //Ô¶³ÌÍ£Ö¹
    public int start_screen_set;                //Æô¶¯´¥ÃþÆÁ¸ø¶¨
    public int start_upper_set;                    //Æô¶¯ÉÏλ»ú¸ø¶¨
    public int consvolswitch;                    //ºãѹÇл»
    public int othermode;                        //4²¢»ò2´®2²¢ÒÔÍâģʽ
    public int consvol_distribution;            //ËÄ´®ºãѹµçѹ·ÖÅäλ
  
    public float consvolmode_chargecurr ;        // 'תΪºãѹģʽ³äµçµçѹֵ',
    public float chargecurr_one ;                // 'µÚ1½×¶Î³äµçµçÁ÷Öµ',
    public float chargecurr_two ;                // 'µÚ2½×¶Î³äµçµçÁ÷Öµ',
    public float chargecurr_three ;                // 'µÚ3½×¶Î³äµçµçÁ÷Öµ',
    public float chargecurr_four ;                // 'µÚ4½×¶Î³äµçµçÁ÷Öµ',
    public float chargecurr_five ;                // 'µÚ5½×¶Î³äµçµçÁ÷Öµ',
    public float currset ;                        // 'µçÁ÷É趨ֵ',
 
    public float volset ;                        // 'µçѹÉ趨ֵ',
    public float stopchargevol_one ;            // 'µÚ1½×¶Î³äµçÖÕÖ¹µçѹ',
    public float stopchargevol_two ;            // 'µÚ2½×¶Î³äµçÖÕÖ¹µçѹ',
    public float stopchargevol_three ;            // 'µÚ3½×¶Î³äµçÖÕÖ¹µçѹ',
    public float stopchargevol_four ;            // 'µÚ4½×¶Î³äµçÖÕÖ¹µçѹ',
    public float stopchargevol_five ;            // 'µÚ5½×¶Î³äµçÖÕÖ¹µçѹ',
      
      
    public Electric_Control_Single_2kw(int electric2kw_id) {
        super();
        electric2KW_id = electric2kw_id;
    }
    
    public void clear() {
        this.upper_pulse_block = 0;                //ÉÏλ»úÂö³å·âËø
        this.remote_start = 0;                    //Ô¶³ÌÆô¶¯
        this.fault_reset = 0;                    //¹ÊÕϸ´Î»
        this.conscurrswitch = 0;                //ºãÁ÷Çл»
        this.constantvol = 0;                    //4²¢»ò2´®2²¢ºãѹ
        this.volset_confirm = 0;                //µçѹ¸ø¶¨È·ÈÏ
        this.currset_confirm = 0;                //µçÁ÷¸ø¶¨È·ÈÏ
        this.remote_stop = 0;                    //Ô¶³ÌÍ£Ö¹
        this.start_screen_set = 0;                //Æô¶¯´¥ÃþÆÁ¸ø¶¨
        this.start_upper_set = 0;                //Æô¶¯ÉÏλ»ú¸ø¶¨
        this.consvolswitch = 0;                    //ºãѹÇл»
        this.othermode = 0;                        //4²¢»ò2´®2²¢ÒÔÍâģʽ
        this.consvol_distribution = 0;            //ËÄ´®ºãѹµçѹ·ÖÅäλ
          
        this.consvolmode_chargecurr = 0;        // 'תΪºãѹģʽ³äµçµçѹֵ',
        this.chargecurr_one = 0;                // 'µÚ1½×¶Î³äµçµçÁ÷Öµ',
        this.chargecurr_two = 0;                // 'µÚ2½×¶Î³äµçµçÁ÷Öµ',
        this.chargecurr_three = 0;                // 'µÚ3½×¶Î³äµçµçÁ÷Öµ',
        this.chargecurr_four = 0;                // 'µÚ4½×¶Î³äµçµçÁ÷Öµ',
        this.chargecurr_five = 0;                // 'µÚ5½×¶Î³äµçµçÁ÷Öµ',
        this.currset = 0;                        // 'µçÁ÷É趨ֵ',
        this.volset = 0;                        // 'µçѹÉ趨ֵ',
        this.stopchargevol_one = 0;                // 'µÚ1½×¶Î³äµçÖÕÖ¹µçѹ',
        this.stopchargevol_two = 0;                // 'µÚ2½×¶Î³äµçÖÕÖ¹µçѹ',
        this.stopchargevol_three = 0;            // 'µÚ3½×¶Î³äµçÖÕÖ¹µçѹ',
        this.stopchargevol_four = 0;            // 'µÚ4½×¶Î³äµçÖÕÖ¹µçѹ',
        this.stopchargevol_five = 0;            // 'µÚ5½×¶Î³äµçÖÕÖ¹µçѹ',
    }
    
    public int getNum() {
        return num;
    }
    public void setNum(int num) {
        this.num = num;
    }
    public int getElectric2KW_id() {
        return electric2KW_id;
    }
    public void setElectric2KW_id(int electric2kw_id) {
        electric2KW_id = electric2kw_id;
    }
    public float getConsvolmode_chargecurr() {
        return consvolmode_chargecurr;
    }
    public void setConsvolmode_chargecurr(float consvolmode_chargecurr) {
        this.consvolmode_chargecurr = consvolmode_chargecurr;
    }
    public float getChargecurr_five() {
        return chargecurr_five;
    }
    public void setChargecurr_five(float chargecurr_five) {
        this.chargecurr_five = chargecurr_five;
    }
    public float getChargecurr_four() {
        return chargecurr_four;
    }
    public void setChargecurr_four(float chargecurr_four) {
        this.chargecurr_four = chargecurr_four;
    }
    public float getChargecurr_three() {
        return chargecurr_three;
    }
    public void setChargecurr_three(float chargecurr_three) {
        this.chargecurr_three = chargecurr_three;
    }
    public float getChargecurr_two() {
        return chargecurr_two;
    }
    public void setChargecurr_two(float chargecurr_two) {
        this.chargecurr_two = chargecurr_two;
    }
    public float getChargecurr_one() {
        return chargecurr_one;
    }
    public void setChargecurr_one(float chargecurr_one) {
        this.chargecurr_one = chargecurr_one;
    }
    public float getCurrset() {
        return currset;
    }
    public void setCurrset(float currset) {
        this.currset = currset;
    }
    public float getVolset() {
        return volset;
    }
    public void setVolset(float volset) {
        this.volset = volset;
    }
    public float getStopchargevol_five() {
        return stopchargevol_five;
    }
    public void setStopchargevol_five(float stopchargevol_five) {
        this.stopchargevol_five = stopchargevol_five;
    }
    public float getStopchargevol_four() {
        return stopchargevol_four;
    }
    public void setStopchargevol_four(float stopchargevol_four) {
        this.stopchargevol_four = stopchargevol_four;
    }
    public float getStopchargevol_three() {
        return stopchargevol_three;
    }
    public void setStopchargevol_three(float stopchargevol_three) {
        this.stopchargevol_three = stopchargevol_three;
    }
    public float getStopchargevol_two() {
        return stopchargevol_two;
    }
    public void setStopchargevol_two(float stopchargevol_two) {
        this.stopchargevol_two = stopchargevol_two;
    }
    public float getStopchargevol_one() {
        return stopchargevol_one;
    }
    public void setStopchargevol_one(float stopchargevol_one) {
        this.stopchargevol_one = stopchargevol_one;
    }
    
    
 
    /**
     * ´´½¨¶ÁÈ¡Êý¾Ý¼¯ºÏ
     * @param master
     * @return
     */
    public BatchRead<Integer> createBatchRead(MyModbusMaster master){
        BatchRead<Integer> batch = new BatchRead<Integer>();        
        batch.addLocator(0,MyModbusUtils.createBaseLocator(330, DataType.TWO_BYTE_INT_SIGNED,master));
        batch.addLocator(1,MyModbusUtils.createBaseLocator(319, DataType.TWO_BYTE_INT_SIGNED,master));
        batch.addLocator(2,MyModbusUtils.createBaseLocator(318, DataType.TWO_BYTE_INT_SIGNED,master));
        batch.addLocator(3,MyModbusUtils.createBaseLocator(317, DataType.TWO_BYTE_INT_SIGNED,master));
        batch.addLocator(4,MyModbusUtils.createBaseLocator(316, DataType.TWO_BYTE_INT_SIGNED,master));
        batch.addLocator(5,MyModbusUtils.createBaseLocator(315, DataType.TWO_BYTE_INT_SIGNED,master));
        batch.addLocator(6,MyModbusUtils.createBaseLocator(27, DataType.TWO_BYTE_INT_SIGNED,master));
        batch.addLocator(7,MyModbusUtils.createBaseLocator(25, DataType.TWO_BYTE_INT_SIGNED,master));
        batch.addLocator(8,MyModbusUtils.createBaseLocator(18, DataType.FOUR_BYTE_FLOAT,master));
        batch.addLocator(9,MyModbusUtils.createBaseLocator(16, DataType.FOUR_BYTE_FLOAT,master));
        batch.addLocator(10,MyModbusUtils.createBaseLocator(415, DataType.FOUR_BYTE_FLOAT,master));
        batch.addLocator(11,MyModbusUtils.createBaseLocator(328, DataType.TWO_BYTE_INT_SIGNED,master));
        batch.addLocator(12,MyModbusUtils.createBaseLocator(326, DataType.TWO_BYTE_INT_SIGNED,master));
        batch.addLocator(13,MyModbusUtils.createBaseLocator(324, DataType.TWO_BYTE_INT_SIGNED,master));
        batch.addLocator(14,MyModbusUtils.createBaseLocator(322, DataType.TWO_BYTE_INT_SIGNED,master));
        batch.addLocator(15,MyModbusUtils.createBaseLocator(320, DataType.TWO_BYTE_INT_SIGNED,master));
        batch.addLocator(16,MyModbusUtils.createBaseLocator(12, DataType.FOUR_BYTE_FLOAT,master));
        batch.addLocator(17,MyModbusUtils.createBaseLocator(10, DataType.FOUR_BYTE_FLOAT,master));
        batch.addLocator(18,MyModbusUtils.createBaseLocator(8, DataType.FOUR_BYTE_FLOAT,master));
        batch.addLocator(19,MyModbusUtils.createBaseLocator(6, DataType.FOUR_BYTE_FLOAT,master));    
        
        return batch;
    }
    /**
     * ½âÎö·µ»ØÇëÇó
     * @param res
     */
    public void putBatchResult(BatchResults<Integer> res) {
        if(res != null) {
            this.consvolmode_chargecurr= MyModbusUtils.readShortToFloat(res.getValue(0));    
            this.chargecurr_five= MyModbusUtils.readShortToFloat(res.getValue(1));    
            this.chargecurr_four= MyModbusUtils.readShortToFloat(res.getValue(2));    
            this.chargecurr_three= MyModbusUtils.readShortToFloat(res.getValue(3));    
            this.chargecurr_two= MyModbusUtils.readShortToFloat(res.getValue(4));    
            this.chargecurr_one= MyModbusUtils.readShortToFloat(res.getValue(5));    
            this.currset= MyModbusUtils.readShortToFloat(res.getValue(6));    
            //this.localgivecurr= MyModbusUtils.readShortToFloat(res.getValue(7));    
            this.volset= (float)res.getValue(8);    
            //this.localgivevol= (float)res.getValue(9);    
            //this.controlangle= (float)res.getValue(10);    
            this.stopchargevol_five= MyModbusUtils.readShortToFloat(res.getValue(11));    
            this.stopchargevol_four= MyModbusUtils.readShortToFloat(res.getValue(12));    
            this.stopchargevol_three= MyModbusUtils.readShortToFloat(res.getValue(13));    
            this.stopchargevol_two= MyModbusUtils.readShortToFloat(res.getValue(14));    
            this.stopchargevol_one= MyModbusUtils.readShortToFloat(res.getValue(15));    
            //this.alldccurr= (float)res.getValue(16);    
            //this.alldcvol= (float)res.getValue(17);    
            //this.brachdccurr= (float)res.getValue(18);    
            //this.brachdcvol= (float)res.getValue(19);    
        }
    }  
      
}