Administrator
2021-04-29 e2b58dc05d331566ef83ba20ab60a419c0e73805
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
package com.base;
 
public class ComBase {
    public static final byte CapType_Rest = 0;
    public static final byte CapType_Real = 1;
 
    public static byte changeIntToByte(int data) {
        return (byte) (data & 0xFF);
    }
 
    public static short changeIntToShort(int data) {
        return (short) (data & 0xFFFF);
    }
 
    public static byte changeShortToByte(short data) {
        return (byte) (data & 0xFF);
    }
 
    public static int changeByteToInt(byte data) {
        int tmp = data;
        return tmp & 0xFF;
    }
 
    public static int changeShortToInt(short data) {
        int tmp = data;
        return tmp & 0xFFFF;
    }
 
    public static double changeShortToDouble(short data) {
        int tmp = data & 0xFFFF;
        return tmp;
    }
 
    public static short changeDoubleToShort(double data) {
        int tmp = (int) data;
        return (short) (tmp & 0xFFFF);
    }
 
    public static double GetFDCurrent(double stdcap, int hourrate) {
        double res = 0.055D;
        switch (hourrate) {
        case 1:
            res = 0.514D;
            break;
        case 2:
            res = 0.306D;
            break;
        case 3:
            res = 0.25D;
            break;
        case 4:
            res = 0.2D;
            break;
        case 5:
            res = 0.166D;
            break;
        case 6:
            res = 0.146D;
            break;
        case 7:
            res = 0.131D;
            break;
        case 8:
            res = 0.118D;
            break;
        case 9:
            res = 0.108D;
            break;
        case 10:
            res = 0.1D;
            break;
        case 20:
            res = 0.055D;
            break;
        case 11:
        case 12:
        case 13:
        case 14:
        case 15:
        case 16:
        case 17:
        case 18:
        case 19:
        default:
            res = 0.055D;
        }
 
        return stdcap * res;
    }
 
    public static int GetHourRate(double stdah, double current) {
        int index = 0;
        double[] value = { 5.14D, 3.06D, 2.5D, 2.0D, 1.66D, 1.46D, 1.31D, 1.18D, 1.08D, 1.0D, 0.55D };
 
        if (stdah < 1.0D) {
            stdah = 1.0D;
        }
        double res = current / (stdah / 10.0D);
        if (res >= 5.14D)
            return 1;
        if (res <= 0.55D)
            return 20;
 
        for (index = 0; index < 10; index++) {
            if ((res <= value[index]) && (res > value[(index + 1)]))
                break;
        }
        if (value[index] - res < res - value[(index + 1)]) {
            return index + 1;
        }
 
        if (index + 2 > 10)
            return 20;
        return index + 2;
    }
 
    public static double N_TO_10H(int n_H) {
        switch (n_H) {
        case 1:
            return 1.818181818181818D;
        case 2:
            return 1.639344262295082D;
        case 3:
            return 1.333333333333333D;
        case 4:
            return 1.265822784810126D;
        case 5:
            return 1.200480192076831D;
        case 6:
            return 1.141552511415525D;
        case 7:
            return 1.09051254089422D;
        case 8:
            return 1.059322033898305D;
        case 9:
            return 1.026694045174538D;
        case 10:
            return 1.0D;
        case 20:
            return 0.9090909090909091D;
        case 11:
        case 12:
        case 13:
        case 14:
        case 15:
        case 16:
        case 17:
        case 18:
        case 19:
        }
        return 1.0D;
    }
 
    public static double GetMonomerCap(double STDAH, int HourRate, double SumAH, double MaxMonomerVol,
            double MonomerVol, double MonomerVolType, byte CapType) {
        if (MaxMonomerVol - MonomerVolType * 0.9D <= 0.0D) {
            return 0.0D;
        }
        if (STDAH < 1.0D) {
            STDAH = 1.0D;
        }
        if (SumAH < 0.0D) {
            SumAH *= -1.0D;
        }
 
        double tmp_cap = MonomerVol - MonomerVolType * 0.9D;
        tmp_cap *= (STDAH - SumAH * N_TO_10H(HourRate));
        double dt_vol = MaxMonomerVol - MonomerVolType * 0.9D;
        if (dt_vol < 0.01D)
            dt_vol = 0.01D;
        tmp_cap /= dt_vol;
        if (tmp_cap < 0.0D) {
            tmp_cap = 0.0D;
        }
        if (CapType == 0)
            return tmp_cap;
        if (CapType == 1) {
            return tmp_cap + SumAH * N_TO_10H(HourRate);
        }
        return (tmp_cap + SumAH * N_TO_10H(HourRate)) * 100.0D / STDAH;
    }
 
    public static int GetRestTimeSecond(double restcap, double curr) {
        double tmp_curr = Math.abs(curr);
        if (tmp_curr < 0.1D) {
            tmp_curr = 0.1D;
        }
        int rest_time = (int) (restcap / tmp_curr * 3600.0D);
        if (rest_time > 356400) {
            rest_time = 356400;
        }
        return rest_time;
    }
}
 
/*
 * Location:
 * C:\Users\LiJun\Desktop\公司各种设备资料\9600显示模块相关文件\后台程序\2018-09-07\BattFBS9600XSP.
 * jar Qualified Name: com.base.ComBase JD-Core Version: 0.6.2
 */