自动充电解决电池电量掉导致的反复充电问题

zw
CZ 5 months ago
parent 69f4cb1b02
commit 5418fca7da

@ -55,7 +55,7 @@ public class AutoChargeTask : ITask
chargerList.Where(it => it.AutoCharge == 1).Select(it => it.Code).ToHashSet();
var binInfos = allBinInfos.Where(it => autoChargeSet.Contains(it.ChargerNo)).ToList();
var binInfos = allBinInfos.Where(it => autoChargeSet.Contains(it.ChargerNo)).ToList();
if (ObjUtils.IsEmpty(binInfos))
{
@ -153,10 +153,9 @@ public class AutoChargeTask : ITask
List<BinInfo> chargingList = binInfos.Where(it => it.ChargeStatus == 1).ToList();
if (canSwapList.Count >= needBatteryCount)
{
int needStopCount = chargingList.Count - (canSwapList.Count - needBatteryCount);
//if (needStopCount > 0)
if(chargingList.Count>0)
if (chargingList.Count > 0)
{
//停电量低的
chargingList.Sort((a, b) => (a.Soc ?? 0).CompareTo(b.Soc ?? 0));
@ -171,7 +170,7 @@ public class AutoChargeTask : ITask
{
List<BinInfo> canChargeList = binInfos.Where(it =>
it.Soc != null && Convert.ToSingle(it.Soc) < StaticStationInfo.ChargeSoc &&
it.CanChargeFlag == 1&&it.Exists==1)
it.CanChargeFlag == 1 && it.Exists == 1)
.ToList();
//启动电量高的
canChargeList.Sort((a, b) => (b.Soc ?? 0).CompareTo(a.Soc ?? 0));
@ -200,14 +199,15 @@ public class AutoChargeTask : ITask
}
#region 达到充电SOC自动停
foreach (var VARIABLE in chargingList)
{
if (VARIABLE.Soc >= StaticStationInfo.ChargeSoc)
{
Log.Info($"auto stop charge {VARIABLE.No} soc>=chaegeSoc");
ClientMgr.GetBySn(VARIABLE.No)?.SendRemoteStopCharging();
}
if (StaticStationInfo.ChargeSoc != 100)
if (VARIABLE.Soc >= StaticStationInfo.ChargeSoc + 1)
{
Log.Info($"auto stop charge {VARIABLE.No} soc>=chaegeSoc");
ClientMgr.GetBySn(VARIABLE.No)?.SendRemoteStopCharging();
}
}
#endregion

Loading…
Cancel
Save