|
|
|
@ -30,7 +30,6 @@ namespace Service.Charger.Client;
|
|
|
|
|
[Scope("InstancePerDependency")]
|
|
|
|
|
public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region 属性
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -52,7 +51,6 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
public bool IsCharged { get; set; } = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 站外两枪时是否在充电
|
|
|
|
|
/// </summary>
|
|
|
|
@ -61,6 +59,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
[1] = false,
|
|
|
|
|
[2] = false
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 充电桩连接状态
|
|
|
|
|
/// </summary>
|
|
|
|
@ -161,6 +160,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
/// 充电桩的遥测
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ConcurrentDictionary<byte, PileUploadTelemetry> PileUploadTelemetry = new();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 充电桩的遥信
|
|
|
|
|
/// </summary>
|
|
|
|
@ -170,6 +170,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
/// 充电桩状态信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ConcurrentDictionary<byte, ChargerPile> ChargerPile = new();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///充电机实时充电功率
|
|
|
|
|
/// </summary>
|
|
|
|
@ -498,6 +499,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
this.Channel.WriteAndFlushAsync(req);
|
|
|
|
|
return Result<bool>.Success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 3.7.1 监控平台远程启动充电桩充电
|
|
|
|
|
/// </summary>
|
|
|
|
@ -507,7 +509,8 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
/// <param name="changePowerCmdType">功率调节参数</param>
|
|
|
|
|
/// <param name="chargeOrderNo"></param>
|
|
|
|
|
/// <returns>充电流水号</returns>
|
|
|
|
|
public Result<string> SendStartOutCharger(byte pn, byte socValue, short changePower=360,byte changePowerCmdType=1 ,
|
|
|
|
|
public Result<string> SendStartOutCharger(byte pn, byte socValue, short changePower = 360,
|
|
|
|
|
byte changePowerCmdType = 1,
|
|
|
|
|
string? chargeOrderNo = null)
|
|
|
|
|
{
|
|
|
|
|
if (!Connected)
|
|
|
|
@ -523,12 +526,14 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
Log().Info(
|
|
|
|
|
$"SendStartOutCharger pn={pn}, socValue={socValue}, changePower={changePower}, changePowerCmdType={changePowerCmdType}, chargeOrderNo={chargeOrderNo}");
|
|
|
|
|
|
|
|
|
|
PileStartCharge pileStartCharge = new PileStartCharge(pn, socValue, changePowerCmdType, changePower,chargeOrderNo);
|
|
|
|
|
PileStartCharge pileStartCharge =
|
|
|
|
|
new PileStartCharge(pn, socValue, changePowerCmdType, changePower, chargeOrderNo);
|
|
|
|
|
|
|
|
|
|
this.Channel.WriteAndFlushAsync(pileStartCharge);
|
|
|
|
|
|
|
|
|
|
return Result<string>.Success(chargeOrderNo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 3.7.3 监控平台远程停止充电桩充电
|
|
|
|
|
/// </summary>
|
|
|
|
@ -544,7 +549,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
|
|
|
|
|
Log().Info(
|
|
|
|
|
$"SendStartOutCharger pn={pn}, stopReason={stopReason}");
|
|
|
|
|
PileStopCharge pileStopCharge=new PileStopCharge(pn,stopReason);
|
|
|
|
|
PileStopCharge pileStopCharge = new PileStopCharge(pn, stopReason);
|
|
|
|
|
this.Channel.WriteAndFlushAsync(pileStopCharge);
|
|
|
|
|
|
|
|
|
|
return Result<string>.Success();
|
|
|
|
@ -556,17 +561,18 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
/// <param name="pn"></param>
|
|
|
|
|
/// <param name="expectedOperatingPower"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public Result<bool> SendPileAdjustPower(byte pn,float expectedOperatingPower)
|
|
|
|
|
public Result<bool> SendPileAdjustPower(byte pn, float expectedOperatingPower)
|
|
|
|
|
{
|
|
|
|
|
if (!Connected)
|
|
|
|
|
{
|
|
|
|
|
return Result<bool>.Fail($"charger-{BinNo} disconnect");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PileAdjustPower powerRegulation = new PileAdjustPower(pn,expectedOperatingPower);
|
|
|
|
|
PileAdjustPower powerRegulation = new PileAdjustPower(pn, expectedOperatingPower);
|
|
|
|
|
this.Channel.WriteAndFlushAsync(powerRegulation);
|
|
|
|
|
return Result<bool>.Success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|