package com.battdata_rt;
|
|
import java.util.Date;
|
|
import com.dec.fbs9100.FBS9100_SysState;
|
import com.dec.fbs9100.FBS9100_batt_testparam;
|
|
public class BattStatData
|
{
|
//----------------------------------------------------------
|
final public static byte BATTDATA_NULL = 0;
|
final public static byte BATTDATA_FLOAT = 1;
|
final public static byte BATTDATA_CHARGE = 2;
|
final public static byte BATTDATA_DISCHARGE = 3;
|
final public static byte BATTDATA_JUNCHARGE = 4;
|
final public static byte BATTDATA_RES = 5;
|
final public static byte BATTDATA_SER = 6;
|
final public static byte BATTDATA_TMP = 7;
|
final public static byte BATTDATA_CONNRES = 8;
|
final public static byte BATTDATA_MONITOR = 9;
|
//----------------------------------------------------------
|
final public static byte BATTSTATE_NULL = 0;
|
final public static byte BATTSTATE_FLOAT = 1;
|
final public static byte BATTSTATE_CHARGE = 2;
|
final public static byte BATTSTATE_DISCHARGE = 3;
|
final public static byte BATTSTATE_JUNCHARGE = 4;
|
final public static byte BATTSTATE_RES = 5;
|
final public static byte BATTSTATE_SER = 6;
|
final public static byte BATTSTATE_TMP = 7;
|
final public static byte BATTSTATE_CONNRES = 8;
|
final public static byte BATTSTATE_MONITOR = 9;
|
//----------------------------------------------------------
|
final public static byte TEST_LOADER_REALLOADER = 1;
|
final public static byte TEST_LOADER_FBI_IDCE = 2;
|
final public static byte TEST_LOADER_FBS9100S = 3;
|
//----------------------------------------------------------
|
//---- FBI/IDCE serials device connection state monitor ----
|
private boolean CurrDataIsUseForIdceFbi = false;
|
private boolean CurrDataIsUseForIdceFbi_LaZha = false;
|
//----------------------------------------------------------
|
private int mSourceBattDataType = 0;
|
private boolean mSybSrvCurrChargeDirPos = true;
|
//----------------------------------------------------------
|
public int dev_FBS9100S_WorkState = FBS9100_SysState.SYS_STATE_STOPPED;
|
public byte battTestState = BATTSTATE_FLOAT;
|
public byte battTestType_For_DataSave = BATTSTATE_FLOAT;
|
public int dataCalCount;
|
public int testRecordCount;
|
public byte testLoaderType = 0;
|
public int test_stoptype = 0;
|
public int recordNum;
|
public int recordNum_BPM7100;
|
public Date startTestTime = new Date();
|
public Date recordTime = new Date();
|
|
public FBS9100_batt_testparam test_param;
|
|
/**
|
* 2021-08-09
|
* 新增属性,修复在记录历史实时数据时程序启动时会记录一笔所有数据为0的数据
|
*/
|
public Date newDataRecordTime = new Date(0,0,0); //new data time that get from fbs_dev;
|
public int testTimeLong;
|
public float onlineVol;
|
public float groupVol;
|
public float groupTmp;
|
public float group_curr;
|
public byte battState;
|
|
private boolean bpm7100_runState = false;
|
|
public float testCurr = 0;
|
public float testCurrAbsMax = 0;
|
public float TestCurr_RT = 0;
|
public float TestCurr_RT_TMP = 0;
|
//public int TestState_RT;
|
|
public float sybase_server_battcurr;
|
public float testCap;
|
public float battRealCap;
|
public float battRestCap;
|
public int battRestTime;
|
|
/**
|
* 2021-08-17 edit @lijun 新增属性[仅在记录单体内阻数据时用到]
|
*/
|
public int batt_res_test_cnt_last = 0;
|
public int batt_res_test_cnt = 0;
|
public int batt_res_test_state = 0;
|
|
//--------------------------------//
|
public BattStatData(int type, boolean syb_srv_curr_charge_dir_pos)
|
{
|
mSourceBattDataType = type;
|
mSybSrvCurrChargeDirPos = syb_srv_curr_charge_dir_pos;
|
init(FBS9100_SysState.IEC61850_SYS_STATE_STOPPED, (byte) BATTSTATE_FLOAT, 0);
|
|
test_param = new FBS9100_batt_testparam();
|
}
|
|
public BattStatData()
|
{
|
mSourceBattDataType = 0;
|
mSybSrvCurrChargeDirPos = true;
|
init(FBS9100_SysState.IEC61850_SYS_STATE_STOPPED, (byte) BATTSTATE_FLOAT, 0);
|
|
test_param = new FBS9100_batt_testparam();
|
}
|
|
public void setBpm7100RunState(boolean stat) {
|
bpm7100_runState = stat;
|
}
|
public boolean getBpm7100RunState() {
|
return bpm7100_runState;
|
}
|
|
public BattStatData clone()
|
{
|
BattStatData bdata = new BattStatData(mSourceBattDataType, mSybSrvCurrChargeDirPos);
|
bdata.battTestState = battTestState;
|
bdata.battTestType_For_DataSave = battTestType_For_DataSave;
|
bdata.battState = battState;
|
bdata.dataCalCount = dataCalCount;
|
bdata.testRecordCount = testRecordCount;
|
bdata.recordNum = recordNum;
|
bdata.recordNum_BPM7100 = recordNum_BPM7100;
|
bdata.startTestTime = new Date(startTestTime.getTime());
|
bdata.testLoaderType = testLoaderType;
|
bdata.test_stoptype = test_stoptype;
|
bdata.recordTime = new Date(recordTime.getTime());
|
bdata.testTimeLong = testTimeLong;
|
bdata.onlineVol = onlineVol;
|
bdata.groupVol = groupVol;
|
bdata.group_curr = group_curr;
|
bdata.groupTmp = groupTmp;
|
bdata.testCurr = testCurr;
|
bdata.testCurrAbsMax = testCurrAbsMax;
|
bdata.sybase_server_battcurr = sybase_server_battcurr;
|
bdata.testCap = testCap;
|
bdata.battRealCap = battRealCap;
|
bdata.battRestCap = battRestCap;
|
bdata.battRestTime = battRestTime;
|
|
return bdata;
|
}
|
|
public void updateNewDataRCTime(Date d_t) {
|
newDataRecordTime.setTime(d_t.getTime());
|
}
|
|
public void init(int dev_stat, byte test_type, int count)
|
{
|
battTestState = test_type;
|
battTestType_For_DataSave = test_type;
|
|
if(BattStatData.BATTSTATE_MONITOR != test_type) {
|
battState = test_type;
|
}
|
|
testLoaderType = TEST_LOADER_REALLOADER;
|
//edit by mxpopstar @20200922
|
this.checkAndSetLoaderType();
|
|
test_stoptype = -1;
|
|
testRecordCount = count;
|
dataCalCount = 0;
|
recordNum = 0;
|
recordNum_BPM7100 = 0;
|
startTestTime = new Date();
|
recordTime = new Date();
|
testTimeLong = 0;
|
testCap = 0;
|
testCurrAbsMax = 0;
|
}
|
|
public void bpm7100_init(byte batt_state)
|
{
|
battState = batt_state;
|
dataCalCount = 0;
|
recordNum_BPM7100 = 0;
|
testCap = 0;
|
testCurrAbsMax = 0;
|
}
|
|
private void upDateCurrRT(float curr, int dev_stat)
|
{
|
TestCurr_RT = curr;
|
if(Math.abs(testCurrAbsMax) < Math.abs(TestCurr_RT))
|
{
|
testCurrAbsMax = TestCurr_RT;
|
}
|
}
|
public void upDatebattTestState(byte test_type) {
|
battTestState = test_type;
|
}
|
public void upDatebattState(byte test_type) {
|
battState = test_type;
|
}
|
public boolean isCurrDataUseForIdceFbi()
|
{
|
return CurrDataIsUseForIdceFbi;
|
}
|
public void setCurrDataIsUseForIdceFbi(boolean stat)
|
{
|
CurrDataIsUseForIdceFbi = stat;
|
}
|
|
public void setLoaderType(byte ld_t) {
|
testLoaderType = ld_t;
|
}
|
public byte getLoaderType() {
|
return testLoaderType;
|
}
|
|
public void checkAndSetLoaderType() {
|
if((FBS9100_SysState.IEC61850_SYS_STATE_CHARGING == this.getDevFBS9100S_WorkState())
|
|| (FBS9100_SysState.IEC61850_SYS_STATE_DISCHARGING == this.getDevFBS9100S_WorkState())) {
|
if(BattStatData.TEST_LOADER_FBS9100S != this.getLoaderType()) {
|
this.setLoaderType(BattStatData.TEST_LOADER_FBS9100S);
|
}
|
}
|
}
|
|
public void setDevFBS9100S_WorkState(int alarm_stat, int wks_t) {
|
test_stoptype = alarm_stat;
|
dev_FBS9100S_WorkState = wks_t;
|
}
|
public void updatetestTimeLong(int timelong) {
|
testTimeLong = timelong;
|
}
|
public int getDevFBS9100S_WorkState() {
|
return dev_FBS9100S_WorkState;
|
}
|
|
public boolean isCurrDataUseForIdceFbi_LaZha()
|
{
|
return CurrDataIsUseForIdceFbi_LaZha;
|
}
|
public void setCurrDataIsUseForIdceFbi_LaZha(boolean stat)
|
{
|
CurrDataIsUseForIdceFbi_LaZha = stat;
|
}
|
|
/*************************************************************************/
|
|
/**
|
* ������FBS������������������group temp
|
* @param vol
|
*/
|
public void updateGroupTempFrom_FBSDev(float temp)
|
{
|
groupTmp = temp;
|
}
|
public void updatebattRestCap(float restcap) {
|
battRestCap = restcap;
|
}
|
public void updatebattRealCap(float RealCap) {
|
battRealCap = RealCap;
|
}
|
/**
|
* ������FBS������������������online vol
|
* @param vol
|
*/
|
public void updateOnlineVolFrom_FBSDev(float vol)
|
{
|
//if(BattData_RT_Array.DATA_SOURCE_FBSDEV == mSourceBattDataType)
|
{
|
onlineVol = vol;
|
}
|
}
|
|
/**
|
* ������FBS�������������������������������
|
* @param vol
|
*/
|
public void updateGroupTmp(float tmp) {
|
groupTmp = tmp;
|
}
|
public void updateGroupVolFrom_FBSDev(float vol)
|
{
|
//if(BattData_RT_Array.DATA_SOURCE_FBSDEV == mSourceBattDataType)
|
{
|
groupVol = vol;
|
}
|
}
|
|
public void updateGroupCurrFrom_FBSDev(float vol) {
|
group_curr = vol;
|
}
|
/*************************************************************************/
|
|
/**
|
* ������FBS��������������������������
|
* @param curr
|
*/
|
public void updateCurrFrom_FBSDev(float curr, int dev_stat)
|
{
|
//if(false == FBI_ConState)
|
{
|
upDateCurrRT(curr, dev_stat);
|
}
|
}
|
|
public void updataCapTest(float testcap) {
|
// TODO Auto-generated method stub
|
testCap = testcap;
|
}
|
|
public void calTestCap(int second_interval)
|
{
|
recordTime = new Date();
|
|
testTimeLong = (int) ((recordTime.getTime() - startTestTime.getTime())/1000);
|
|
testCap += (testCurr*second_interval)/3600;
|
|
if((++dataCalCount) >= 36000) {
|
dataCalCount = 0;
|
}
|
}
|
}
|