|
|
|
@ -239,7 +239,10 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
_chargeOrderRepository = chargeOrderRepository;
|
|
|
|
|
_binInfoRepository = binInfoRepository;
|
|
|
|
|
}
|
|
|
|
|
public ChargerClient()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private ILog Log()
|
|
|
|
|
{
|
|
|
|
|
var name = "Charger" + this.Sn;
|
|
|
|
@ -300,9 +303,9 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="socLimit">SOC限制.百分比</param>
|
|
|
|
|
/// <param name="changePowerCmdType">功率调节指令类型.默认1 绝对功率值</param>
|
|
|
|
|
/// <param name="changePower">1kw/位,默认3600</param>
|
|
|
|
|
/// <param name="changePower">1kw/位,默认2400</param>
|
|
|
|
|
/// <param name="chargeOrderNo">充电流水号</param>
|
|
|
|
|
public Result<string> SendRemoteStartCharging(byte socLimit, float changePower = 360, byte changePowerCmdType = 1,
|
|
|
|
|
public Result<string> SendRemoteStartCharging(byte socLimit, float changePower = 2400, byte changePowerCmdType = 1,
|
|
|
|
|
string? chargeOrderNo = null)
|
|
|
|
|
{
|
|
|
|
|
if (!Connected)
|
|
|
|
@ -321,11 +324,11 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
CurrentCmd = JsonConvert.SerializeObject(remoteStartCharging, Formatting.Indented) + "\r\n" +
|
|
|
|
|
BitUtls.BytesToHexStr(remoteStartCharging.ToBytes());
|
|
|
|
|
|
|
|
|
|
AuxiliaryPower auxiliaryPower0 = new AuxiliaryPower(0);
|
|
|
|
|
AuxiliaryPower auxiliaryPower0 = new AuxiliaryPower(2);
|
|
|
|
|
AuxiliaryPower auxiliaryPower1 = new AuxiliaryPower(1);
|
|
|
|
|
this.Channel.WriteAndFlushAsync(auxiliaryPower0);
|
|
|
|
|
Thread.Sleep(3000);
|
|
|
|
|
this.Channel.WriteAndFlushAsync(auxiliaryPower1);
|
|
|
|
|
//this.Channel.WriteAndFlushAsync(auxiliaryPower0);
|
|
|
|
|
//Thread.Sleep(3000);
|
|
|
|
|
//this.Channel.WriteAndFlushAsync(auxiliaryPower1);
|
|
|
|
|
this.Channel.WriteAndFlushAsync(remoteStartCharging);
|
|
|
|
|
return Result<string>.Success(chargeOrderNo);
|
|
|
|
|
}
|
|
|
|
@ -358,7 +361,6 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
{
|
|
|
|
|
return Result<bool>.Fail($"charger-{BinNo} disconnect");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PowerRegulation powerRegulation = new PowerRegulation(expectedOperatingPower);
|
|
|
|
|
this.Channel.WriteAndFlushAsync(powerRegulation);
|
|
|
|
|
return Result<bool>.Success();
|
|
|
|
@ -501,7 +503,23 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
this.Channel.WriteAndFlushAsync(offlineStopCharging);
|
|
|
|
|
return Result<bool>.Success();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 3.4.9 监控平台下发站外允许充电 SOC
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="enabled"> </param>
|
|
|
|
|
public Result<bool> SendOutSideAllowChargingSoc(byte enabled)
|
|
|
|
|
{
|
|
|
|
|
if (!Connected)
|
|
|
|
|
{
|
|
|
|
|
return Result<bool>.Fail($"charger-{BinNo} disconnect");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OutSideAllowChargingSoc offlineStopCharging = new OutSideAllowChargingSoc(enabled);
|
|
|
|
|
CurrentCmd = JsonConvert.SerializeObject(offlineStopCharging, Formatting.Indented) + "\r\n" +
|
|
|
|
|
BitUtls.BytesToHexStr(offlineStopCharging.ToBytes());
|
|
|
|
|
this.Channel.WriteAndFlushAsync(offlineStopCharging);
|
|
|
|
|
return Result<bool>.Success();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 3.4.12 站控设备切换站内/站外充电切换
|
|
|
|
|
/// </summary>
|
|
|
|
@ -592,7 +610,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
///查询电池信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Result<bool> SendQueryBattery()
|
|
|
|
|
{
|
|
|
|
@ -652,19 +670,23 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
|
|
|
|
|
//判断水冷继电器状态为断开
|
|
|
|
|
|
|
|
|
|
var relation = StaticStationInfo.RelationMap[Sn];
|
|
|
|
|
var waterCoolClient = WaterCoolClientMgr.GetBySn(relation.WaterCoolerCode)
|
|
|
|
|
;
|
|
|
|
|
if (waterCoolClient == null)
|
|
|
|
|
{
|
|
|
|
|
return Result<bool>.Fail($"液冷机组未初始化");
|
|
|
|
|
}
|
|
|
|
|
#region 水冷判断先屏蔽
|
|
|
|
|
// TODO 水冷判断先屏蔽
|
|
|
|
|
//var relation = StaticStationInfo.RelationMap[Sn];
|
|
|
|
|
//var waterCoolClient = WaterCoolClientMgr.GetBySn(relation.WaterCoolerCode)
|
|
|
|
|
// ;
|
|
|
|
|
//if (waterCoolClient == null)
|
|
|
|
|
//{
|
|
|
|
|
// return Result<bool>.Fail($"液冷机组未初始化");
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!waterCoolClient.WaitIsClose())
|
|
|
|
|
{
|
|
|
|
|
return Result<bool>.Fail($"继电器未断开");
|
|
|
|
|
}
|
|
|
|
|
//if (!waterCoolClient.WaitIsClose())
|
|
|
|
|
//{
|
|
|
|
|
// return Result<bool>.Fail($"继电器未断开");
|
|
|
|
|
//}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RedisHelper redisHelper = AppInfo.Container.Resolve<RedisHelper>();
|
|
|
|
@ -693,7 +715,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
BatteryNo = BatteryNo,
|
|
|
|
|
CmdStatus = 0,
|
|
|
|
|
ChargerNo = BinNo,
|
|
|
|
|
ChargeMode = 1,
|
|
|
|
|
ChargeMode = 0,
|
|
|
|
|
SwapOrderSn = swapOrder?.SwapOrderSn,
|
|
|
|
|
StartMode = 1,
|
|
|
|
|
StartType = startType
|
|
|
|
|