mxpopstar
2022-05-03 e75ef5f04f61aa5fbd89fd5c413dcee1819b7a91
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
package com.dev.ntm.cmd;
 
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
 
import com.dev.bts.data.FBS9100_ComBase;
 
public class NTM_TestParam implements Cloneable
{
    private final int BYTE_LEN = (2*42);
    
    public int test_mode = 0;                    //²âÊÔģʽ        ÔÚÏß,ÀëÏß
    public int acstop_op = 0;                    //Í£µç´¦Àí
    public int nominal_cap = 0;                    //±ê³ÆÈÝÁ¿        ·¶Î§0-9999AH
    public int hourly_rate = 0;                    //·ÅµçСʱÂÊ        0-20
    public double preset_discur = 0;            //·ÅµçµçÁ÷        
    public double preset_discap = 0;            //·ÅµçÈÝÁ¿        ·¶Î§:0-9999AH
    public int preset_distimelong = 0;            //·Åµçʱ³¤        µ¥Î»:·ÖÖÓ
    public double monvol_lower = 0;                //µ¥ÌåµçѹÏÂÏÞ    ·Ö±æÂÊ0.001,·¶Î§:0-20V
    public double groupvol_lower = 0;            //×é¶ËµçѹÏÂÏÞ    ·Ö±æÂÊ0.1,·¶Î§:1-650V
    public int mon_cnt = 0;                        //µ¥ÌåÊýÁ¿        ·¶Î§:1-300
    public int battgroup_cnt = 0;                //µç³Ø×éÊý        ·¶Î§:1-4
    public int monvol_lower_cnt = 0;            //µ¥ÌåµçѹÏÂÏÞÊýÁ¿
    public double monvol_type = 0;                //ֻȡֵ1.2, 2.0, 6.0, 12.0, 3.2, 3.7
    public int dischg_mode = 0;                    //·Åµçģʽ: 0ºãÁ÷·Åµç    1ºã¹¦Âʷŵç
    public double preset_dispower = 0;            //Ô¤·Å¹¦ÂÊ    ·Ö±æÂÊ0.1    ·¶Î§0-7.5kw
    public double preset_disres = 0;            //Ô¤·Å×èÖµ    ·Ö±æÂÊ0.01
    
    public double preset_chgcurr = 0;            //³äµçµçÁ÷
    public double preset_chgvol = 0;            //³äµçµçѹ
    public double preset_chgvol_float = 0;        //³äµç¸¡³äµçѹ
    public double preset_chgcap = 0;            //³äµçÈÝÁ¿
    public int preset_chgtimelong = 0;            //³äµçʱ³¤
    public int preset_chgtimelong_float = 0;    //¸¡³äʱ³¤
    public double preset_chgstop_curr = 0;        //³äµç½ØÖ¹µçÁ÷
    public double groupvol_upper = 0;            //×é¶ËµçѹÉÏÏÞ
    public double monvol_upper = 0;                //µ¥ÌåµçѹÉÏÏÞ
    public int monvol_upper_cnt = 0;            //µ¥ÌåÉÏÏÞÊýÁ¿
    public double chgtemp_upper = 0;            //³äµçζÈÉÏÏÞ
    public double distemp_upper = 0;            //·ÅµçζÈÉÏÏÞ
    
    public int circle_starttype = 0;            //Ñ­»·³ä·Åµç»î»¯Æðµã 0·Åµç , 1³äµç
    public int circle_cnt = 0;                    //Ñ­»·´ÎÊý1-50´Î
    public int waitdis_timelong = 0;            //³äÍê¾²ÖÃʱ¼ä1-500·ÖÖÓ
    public int waitchg_timelong = 0;            //·ÅÍê¾²ÖÃʱ¼ä1-500·ÖÖÓ
    
    public double dcdcvol_upper = 0;            //FBI»úÐͷŵçʱÉýѹÉÏÏÞ
    public double onlinevol_lower = 0;            //FBO/FBI»úÐͷŵçʱÔÚÏßµçѹµÍ
    
    public int chargeC_cnt = 0;                        //ºãÁ÷³äµç×ܽ׶ÎÊý1-3
    public int chargeC_index = 0;                    //ÉèÖõ±Ç°½×¶Îindex   0-2
    public double[] chargeC_curr = new double[3];    //ºãÁ÷½×¶Î³äµçµçÁ÷ ·¶Î§1-100A
    public int[] chargeC_timelong = new int[3];        //ºãÁ÷½×¶Î³äµçʱ¼ä
    
    
    
    public NTM_TestParam clone()
    {
        NTM_TestParam obj = null;  
        try {
            obj = (NTM_TestParam)super.clone();
        } catch(CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return obj;
    }
    
    public void clear()
    {
        test_mode = 0;
        acstop_op = 0;
        nominal_cap = 0;
        hourly_rate = 0;
        preset_discur = 0;
        preset_discap = 0;
        preset_distimelong = 0;
        monvol_lower = 0;
        groupvol_lower = 0;
        mon_cnt = 0;
        battgroup_cnt = 0;
        monvol_lower_cnt = 0;
        monvol_type = 0;
        dischg_mode = 0;
        preset_dispower = 0;
        preset_disres = 0;
        
        preset_chgcurr = 0;
        preset_chgvol = 0;
        preset_chgvol_float = 0;
        preset_chgcap = 0;
        preset_chgtimelong = 0;
        preset_chgtimelong_float = 0;
        preset_chgstop_curr = 0;
        groupvol_upper = 0;
        monvol_upper = 0;
        monvol_upper_cnt = 0;
        chgtemp_upper = 0;
        distemp_upper = 0;
        
        circle_starttype = 0;
        circle_cnt = 0;
        waitdis_timelong = 0;
        waitchg_timelong = 0;
        
        dcdcvol_upper = 0;
        onlinevol_lower = 0;
        
        chargeC_cnt = 0;
        chargeC_index = 0;
        for(int n=0; n<chargeC_curr.length; n++) {
            chargeC_curr[n] = 0;
            chargeC_timelong[n] = 0;
        }
    }
    
    public boolean putByteBuffer(final ByteBuffer bf) {
        
        if(bf.limit() < BYTE_LEN){
            return false;
        }
        
        bf.position(0);
        
        test_mode = FBS9100_ComBase.changeShortToInt(bf.getShort());
        acstop_op = FBS9100_ComBase.changeShortToInt(bf.getShort());
        nominal_cap = FBS9100_ComBase.changeShortToInt(bf.getShort());
        hourly_rate = FBS9100_ComBase.changeShortToInt(bf.getShort());
        preset_discur = FBS9100_ComBase.changeShortToDouble(bf.getShort());    
        preset_discap = FBS9100_ComBase.changeShortToDouble(bf.getShort());    
        preset_distimelong = FBS9100_ComBase.changeShortToInt(bf.getShort());
        monvol_lower = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 100;
        groupvol_lower = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 10;
        mon_cnt = FBS9100_ComBase.changeShortToInt(bf.getShort());
        battgroup_cnt = FBS9100_ComBase.changeShortToInt(bf.getShort());
        monvol_lower_cnt = FBS9100_ComBase.changeShortToInt(bf.getShort());
        monvol_type = FBS9100_ComBase.changeShortToDouble(bf.getShort())/10;
        dischg_mode = FBS9100_ComBase.changeShortToInt(bf.getShort());
        preset_dispower = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 10;
        preset_disres = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 100;
        
        preset_chgcurr = FBS9100_ComBase.changeShortToDouble(bf.getShort());
        preset_chgvol = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 10;
        preset_chgvol_float = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 10;
        preset_chgcap = FBS9100_ComBase.changeShortToInt(bf.getShort());
        preset_chgtimelong = FBS9100_ComBase.changeShortToInt(bf.getShort());
        preset_chgtimelong_float = FBS9100_ComBase.changeShortToInt(bf.getShort());
        preset_chgstop_curr = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 10;
        groupvol_upper = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 10;
        monvol_upper = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 100;
        monvol_upper_cnt = FBS9100_ComBase.changeShortToInt(bf.getShort());
        chgtemp_upper = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 10;
        distemp_upper = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 10;
        
        circle_starttype = FBS9100_ComBase.changeShortToInt(bf.getShort());
        circle_cnt = FBS9100_ComBase.changeShortToInt(bf.getShort());
        waitdis_timelong = FBS9100_ComBase.changeShortToInt(bf.getShort());
        waitchg_timelong = FBS9100_ComBase.changeShortToInt(bf.getShort());
        
        onlinevol_lower = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 10;
        dcdcvol_upper = FBS9100_ComBase.changeShortToDouble(bf.getShort()) / 10;
        
        chargeC_cnt = FBS9100_ComBase.changeByteToInt(bf.get());
        chargeC_index = FBS9100_ComBase.changeByteToInt(bf.get());
        for(int n=0; n<chargeC_curr.length; n++) {
            chargeC_curr[n] = FBS9100_ComBase.changeShortToDouble(bf.getShort());
        }
        for(int n=0; n<chargeC_timelong.length; n++) {
            chargeC_timelong[n] = FBS9100_ComBase.changeShortToInt(bf.getShort());
        }
        
        return true;
    }
    
    public ByteBuffer getByteBuffer()
    {
        ByteBuffer bf = ByteBuffer.allocate(BYTE_LEN);
        bf.order(ByteOrder.LITTLE_ENDIAN);
        bf.position(0);
        
        bf.putShort(FBS9100_ComBase.changeIntToShort(test_mode));
        bf.putShort(FBS9100_ComBase.changeIntToShort(acstop_op));
        bf.putShort(FBS9100_ComBase.changeIntToShort(nominal_cap));
        bf.putShort(FBS9100_ComBase.changeIntToShort(hourly_rate));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(preset_discur));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(preset_discap));
        bf.putShort(FBS9100_ComBase.changeIntToShort(preset_distimelong));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(monvol_lower*100));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(groupvol_lower*10));
        bf.putShort(FBS9100_ComBase.changeIntToShort(mon_cnt));
        bf.putShort(FBS9100_ComBase.changeIntToShort(battgroup_cnt));
        bf.putShort(FBS9100_ComBase.changeIntToShort(monvol_lower_cnt));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(monvol_type*10));
        bf.putShort(FBS9100_ComBase.changeIntToShort(dischg_mode));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(preset_dispower*10));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(preset_disres*100));
        
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(preset_chgcurr));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(preset_chgvol*10));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(preset_chgvol_float*10));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(preset_chgcap));
        bf.putShort(FBS9100_ComBase.changeIntToShort(preset_chgtimelong));
        bf.putShort(FBS9100_ComBase.changeIntToShort(preset_chgtimelong_float));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(preset_chgstop_curr*10));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(groupvol_upper*10));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(monvol_upper*100));
        bf.putShort(FBS9100_ComBase.changeIntToShort(monvol_upper_cnt));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(chgtemp_upper*10));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(distemp_upper*10));
        
        bf.putShort(FBS9100_ComBase.changeIntToShort(circle_starttype));
        bf.putShort(FBS9100_ComBase.changeIntToShort(circle_cnt));
        bf.putShort(FBS9100_ComBase.changeIntToShort(waitdis_timelong));
        bf.putShort(FBS9100_ComBase.changeIntToShort(waitchg_timelong));
        
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(onlinevol_lower*10));
        bf.putShort(FBS9100_ComBase.changeDoubleToShort(dcdcvol_upper*10));
        
        bf.put(FBS9100_ComBase.changeIntToByte(chargeC_cnt));
        bf.put(FBS9100_ComBase.changeIntToByte(chargeC_index));
        for(int n=0; n<chargeC_curr.length; n++) {
            bf.putShort(FBS9100_ComBase.changeDoubleToShort(chargeC_curr[n]));
        }
        for(int n=0; n<chargeC_timelong.length; n++) {
            bf.putShort(FBS9100_ComBase.changeDoubleToShort(chargeC_timelong[n]));
        }
        
        bf.putShort((short) 0x00);
        
        bf.flip();
        
        return bf;
    }
 
    @Override
    public String toString() {
        return "FBS9100_ParamDischarge [BYTE_LEN=" + BYTE_LEN 
                + ", test_mode=" + test_mode 
                + ", acstop_op=" + acstop_op
                + ", nominal_cap=" + nominal_cap 
                + ", HourRate=" + hourly_rate 
                + ", DisCurr=" + preset_discur 
                + ", DisCap=" + preset_discap 
                + ", DisTime=" + preset_distimelong
                + ", monvol_lower=" + monvol_lower 
                + ", groupvol_lower=" + groupvol_lower 
                + ", mon_cnt=" + mon_cnt 
                + ", battgroup_cnt=" + battgroup_cnt 
                + ", monvol_lower_cnt=" + monvol_lower_cnt
                + ", monvol_type=" + monvol_type 
                + ", dischg_mode=" + dischg_mode 
                + ", preset_dispower=" + preset_dispower
                + ", preset_disres=" + preset_disres 
                
                + ", preset_chgcurr=" + preset_chgcurr 
                + ", preset_chgvol=" + preset_chgvol 
                + ", preset_chgvol_float=" + preset_chgvol_float
                + ", preset_chgcap=" + preset_chgcap 
                + ", preset_chgtimelong=" + preset_chgtimelong 
                + ", preset_chgtimelong_float=" + preset_chgtimelong_float 
                + ", preset_chgstop_curr=" + preset_chgstop_curr
                + ", groupvol_upper=" + groupvol_upper 
                + ", monvol_upper=" + monvol_upper 
                + ", monvol_upper_cnt=" + monvol_upper_cnt 
                + ", chgtemp_upper=" + chgtemp_upper 
                + ", distemp_upper=" + distemp_upper 
                
                + ", circle_starttype=" + circle_starttype 
                + ", circle_cnt=" + circle_cnt 
                + ", waitdis_timelong=" + waitdis_timelong 
                + ", waitchg_timelong=" + waitchg_timelong 
                + ", onlinevol_lower=" + onlinevol_lower 
                + ", dcdcvol_upper=" + dcdcvol_upper 
                + ", chargeC_cnt=" + chargeC_cnt 
                + ", chargeC_index=" + chargeC_index 
                + ", chargeC_curr[0]=" + chargeC_curr[0] 
                + ", chargeC_curr[1]=" + chargeC_curr[1] 
                + ", chargeC_curr[2]=" + chargeC_curr[2] 
                + ", chargeC_timelong[0] =" + chargeC_curr[0] 
                + ", chargeC_timelong[1] =" + chargeC_curr[1] 
                + ", chargeC_timelong[2] =" + chargeC_curr[2]
                + "]";
    }
    
}
/***************************************************************************************
****************************** end of file (FBS_TestParam) *****************************
***************************************************************************************/