FBS9600通信程序,带了均衡电压版本
Administrator
2021-08-12 8467d3be4ce3be340d36f45c83d370def9e7e50f
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
package com.donghuan.c_interface;
 
import java.util.ArrayList;
 
import com.battdata_rt.BattData_RT_Array;
 
public class CInterfaceState {
    
    public ArrayList<CIntefaceStateData> m_al_stat = new ArrayList<CIntefaceStateData>();
    
    public int alm_com_err_count = 0;
    public long alm_rec_id = 0;
    
    public CInterfaceState(BattData_RT_Array al_Data) {
        m_al_stat.add(new CIntefaceStateData(0));
        for(int n=0; n<al_Data.getItemCount(); n++) {
            m_al_stat.add(new CIntefaceStateData(al_Data.getItem(n).BattGroupId));
        }
    }
    
    public void setTxCountInc(int bg_id) {
        for(int n=0; n<m_al_stat.size(); n++) {
            if(bg_id == m_al_stat.get(n).bg_id) {
                m_al_stat.get(n).tx_count += 1;
                if(m_al_stat.get(n).tx_count > 100000) {
                    m_al_stat.get(n).tx_count = 10;
                }
                break;
            }
        }
    }
    
    public void setAlmErrCountInc() {
        if(alm_com_err_count < 10000) {
            if(alm_com_err_count < 0) {
                alm_com_err_count = 0;
            }
            alm_com_err_count++;
        }
    }
    
    public void setErrCountInc(int bg_id) {
        
        setAlmErrCountInc();
        
        for(int n=0; n<m_al_stat.size(); n++) {
            if(bg_id == m_al_stat.get(n).bg_id) {
                if(m_al_stat.get(n).com_err_count < 1000000) {
                    m_al_stat.get(n).com_err_count += 1;
                } else {
                    m_al_stat.get(n).com_err_type = 1;
                }
                break;
            }
        }
    }
    
    public void clearErrCount(int bg_id) {
        boolean no_err = true;
        for(int n=0; n<m_al_stat.size(); n++) {
            CIntefaceStateData csd = m_al_stat.get(n);
            if(bg_id == csd.bg_id) {
                csd.com_err_count = 0;
                csd.com_err_type = 0;
            } 
            if(csd.com_err_count > 0) {
                no_err = false;
            }
            
            if(true == no_err) {
                alm_com_err_count = 0;
            }
        }
    }
    
    public void setBaseProcessValue(int val, int sum) {
        for(int n=0; n<m_al_stat.size(); n++) {
            if(0 == m_al_stat.get(n).bg_id) {
                m_al_stat.get(n).tx_count = val;
                m_al_stat.get(n).rx_count = sum;
                break;
            }
        }
    }
}