BMS 를 RS232 클래스에서 폴링방식 전용 클래스로 변경
BMS 정보중 현재 사용 전류와 와트를 표시함 사용전류를 통해서 충전여부를 자동 판다시키고, 해당 값은 Manual Charge 플래그에 설정함.
This commit is contained in:
@@ -25,15 +25,18 @@ namespace Project
|
||||
DateTime lastbmstime = DateTime.Now;
|
||||
private void Bms_Message(object sender, arDev.BMS.MessageEventArgs e)
|
||||
{
|
||||
if (e.MsgType == arDev.arRS232.MessageType.Error) PUB.logbms.AddE( e.Message);
|
||||
|
||||
if (e.MsgType == arDev.BMSSerialComm.MessageType.Error) PUB.logbms.AddE(e.Message);
|
||||
else
|
||||
{
|
||||
VAR.TIME[eVarTime.LastRecv_BAT] = DateTime.Now;
|
||||
|
||||
var hexstr = e.Data.GetHexString().Trim();
|
||||
bool addlog = false;
|
||||
var logtimesec = 30;
|
||||
if (hexstr.StartsWith("DD 04"))
|
||||
{
|
||||
if (lastbms04.Equals(hexstr.Substring(0,5)) == false)
|
||||
if (lastbms04.Equals(hexstr.Substring(0, 5)) == false)
|
||||
{
|
||||
addlog = true;
|
||||
lastbms04 = "DD 04";
|
||||
@@ -133,37 +136,49 @@ namespace Project
|
||||
}
|
||||
}
|
||||
|
||||
if(addlog)
|
||||
PUB.logbms.Add("BMS:" + hexstr);
|
||||
if (addlog)
|
||||
{
|
||||
//if (e.MsgType == arDev.arRS232.MessageType.Recv)
|
||||
// PUB.logbms.Add("RX", e.Data.GetHexString());
|
||||
//else if (e.MsgType == arDev.arRS232.MessageType.Send)
|
||||
// PUB.logbms.Add("TX", e.Data.GetHexString());
|
||||
//else
|
||||
{
|
||||
PUB.logbms.Add(e.MsgType.ToString(),e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
private void BMS_ChargeDetect(object sender, arDev.ChargetDetectArgs e)
|
||||
{
|
||||
//자동충전중이아니고 멈춰있다면 수동 충전으로 전환한다
|
||||
if (PUB.AGV.system1.Battery_charging == false && PUB.AGV.system1.agv_stop == true && VAR.BOOL[eVarBool.FLAG_CHARGEONM] == false)
|
||||
VAR.TIME[eVarTime.LastRecv_BAT] = DateTime.Now;
|
||||
if (e.Detected == true) //충전이 감지되었다.
|
||||
{
|
||||
if (PUB.setting.DetectManualCharge)
|
||||
if (VAR.BOOL[eVarBool.FLAG_AUTORUN] == false && VAR.BOOL[eVarBool.FLAG_CHARGEONM] == false)
|
||||
{
|
||||
VAR.BOOL[eVarBool.FLAG_CHARGEONM] = true;
|
||||
PUB.Speak(Lang.충전이감지되어수동충전으로전환합니다);
|
||||
if (PUB.AGV.system1.agv_run == true) PUB.AGV.AGVMoveStop("수동충전감지");
|
||||
}
|
||||
else
|
||||
{
|
||||
PUB.log.Add($"충전이 감지되었지만 메뉴얼 전환 비활성화됨");
|
||||
}
|
||||
|
||||
}
|
||||
else PUB.logbms.AddI("Battery Charge Off");
|
||||
|
||||
}
|
||||
|
||||
private void Bms_BMSDataReceive(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
VAR.TIME[eVarTime.LastRecv_BAT] = DateTime.Now;
|
||||
//PUB.mapctl.Manager.agv.BatteryLevel = PUB.BMS.Current_Level;
|
||||
//PUB.mapctl.Manager.agv.BatteryTemp1 = PUB.BMS.Current_temp1;
|
||||
//PUB.mapctl.Manager.agv.BatteryTemp2 = PUB.BMS.Current_temp2;
|
||||
|
||||
// [Sync] Update VirtualAGV Battery
|
||||
// [Sync] Update VirtualAGV Battery
|
||||
PUB.UpdateAGVBattery(PUB.BMS.Current_Level);
|
||||
|
||||
if (PUB.BMS.Current_Level <= PUB.setting.ChargeStartLevel)
|
||||
@@ -188,6 +203,7 @@ namespace Project
|
||||
}
|
||||
private void BMS_BMSCellDataReceive(object sender, arDev.BMSCelvoltageEventArgs e)
|
||||
{
|
||||
VAR.TIME[eVarTime.LastRecv_BAT] = DateTime.Now;
|
||||
EEMStatus.MakeBMSInformation_Cell();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user