CZ 8 months ago
parent 6a2dcfdf89
commit fb1fa2de40

@ -6,6 +6,7 @@ using Service.Charger.Codec;
using Service.Charger.Common;
using Service.Charger.Handler;
using Service.Charger.Msg.Charger.Req;
using Service.Charger.Msg.Charger.Resp;
using Service.Charger.Msg.Host.Req;
namespace Service.Charger.Client;
@ -55,9 +56,26 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
/// </summary>
public BatteryPackStateAndFault? BatteryPackStateAndFault { get; set; }
/// <summary>
/// 充放电设备应答站功率调节指令
/// </summary>
public PowerRegulationRes PowerRegulationRes { get; set; }
/// <summary>
/// 电池包实时遥信上报(站内充电模式有电池包时周期性上传)
/// </summary>
public RemoteSignaling RemoteSignaling { get; set; }
/// <summary>
/// 充电机上报车辆 VIN
/// </summary>
public VehicleVIN VehicleVIN { get; set; }
/// <summary>
/// 充放电机应答辅助控制
/// </summary>
public AuxiliaryPowerRes AuxiliaryPowerRes { get; set; }
/// <summary>
/// 充放电上报交流电表数据(交流电表接到充电机上的情况)
/// </summary>
public AcMeter AcMeter { get; set; }
/// <summary>
///充电机遥信数据
/// </summary>
@ -94,7 +112,10 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
/// 电池编码
/// </summary>
public string BatterSn { get; set; }
/// <summary>
/// 远程升级-监控网关上送升级完成确认帧
/// </summary>
public UplinkUpgrade UplinkUpgrade { get; set; }
#region 发送指令
private ushort IncreAuthTimes()
@ -161,6 +182,66 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
return Connected;
}
/// <summary>
/// 监控平台发送功率调节指令
/// </summary>
/// <param name="expectedOperatingPower">期望运行功率</param>
public void SendPowerRegulation(ushort expectedOperatingPower)
{
PowerRegulation powerRegulation = new PowerRegulation(expectedOperatingPower);
this.Channel.WriteAndFlushAsync(powerRegulation);
}
/// <summary>
/// 监控平台下发辅源控制指令
/// </summary>
/// <param name="openFlag">打开辅助电源标志 1电池包辅助电源导通 0电池包辅助电源断开</param>
public void SendAuxiliaryPower(byte openFlag)
{
AuxiliaryPower auxiliaryPower = new AuxiliaryPower(openFlag);
this.Channel.WriteAndFlushAsync(auxiliaryPower);
}
/// <summary>
/// 监控平台下发电池仓的状态
/// </summary>
/// <param name="battery">是否有电池 0:无电池 1有电池</param>
/// <param name="connectionState">电接头连接状态 0:未连接 1: 已连接</param>
/// <param name="waterCondition">水接头状态 0:未连接 1: 已连接</param>
public void SendBatteryHolderStatus(byte battery, byte connectionState, byte waterCondition)
{
BatteryHolderStatus batteryHolderStatus = new BatteryHolderStatus(battery, connectionState, waterCondition);
this.Channel.WriteAndFlushAsync(batteryHolderStatus);
}
/// <summary>
/// 站控下发 VIN 鉴权的结果
/// </summary>
/// <param name="vinresult">VIN 鉴权结果 1:通过 2 不通过</param>
public void SendAuthenticationVIN(byte vinresult)
{
AuthenticationVIN authenticationVIN = new AuthenticationVIN(vinresult);
this.Channel.WriteAndFlushAsync(authenticationVIN);
}
/// <summary>
/// 远程升级-站级监控升级请求下发
/// </summary>
/// <param name="executionControl">执行控制 0x01立即执行 0x02空闲执行</param>
/// <param name="downloadTimeout">下载超时时间</param>
/// <param name="versionNumber">版本号</param>
/// <param name="fileName">文件名称</param>
/// <param name="fileSize">文件大小</param>
/// <param name="mD5Verification">MD5校验值</param>
/// <param name="url">URL文件路径</param>
public void SendUpgradeRequest(byte executionControl, byte downloadTimeout, string versionNumber,
string fileName, uint fileSize, string mD5Verification, string url)
{
UpgradeRequest upgradeRequest=new UpgradeRequest(executionControl, downloadTimeout, versionNumber, fileName, fileSize, mD5Verification, url);
this.Channel.WriteAndFlushAsync(upgradeRequest);
}
#endregion
public void SessionAttr(int sn, int eqmTypeNo, string eqmCode, string destAddr)

@ -112,33 +112,31 @@ public class Decoder : ByteToMessageDecoder
{
1 => ModelConvert.Decode<FinishStartCharging>(bytes),
3 => ModelConvert.Decode<StopCharging>(bytes),
6 => ModelConvert.Decode<ChargingPowerRegulationRes>(bytes),
6 => ModelConvert.Decode<PowerRegulationRes>(bytes),
10 => ModelConvert.Decode<AuxiliaryPowerRes>(bytes),
11 => ModelConvert.Decode<Login>(bytes),
13 => ModelConvert.Decode<HeartBeat>(bytes),
21 => ModelConvert.Decode<AdjustChargeRateRes>(bytes),
25 => ModelConvert.Decode<AuthRes>(bytes),
//40 => ModelConvert.Decode<ValidationFailedResult>(bytes),
//41 => ModelConvert.Decode<UploadVinResult>(bytes),
34 => ModelConvert.Decode<UpgradeRequestRes>(bytes),
35 => ModelConvert.Decode<UplinkUpgrade>(bytes),
41 => ModelConvert.Decode<VehicleVIN>(bytes),
44 => ModelConvert.Decode<OfflineStopChargingRes>(bytes),
//46 => ModelConvert.Decode<ChargingSOC>(bytes),
48 => ModelConvert.Decode<SetPeakVallyTimeRes>(bytes),
50 => ModelConvert.Decode<ChangeChargeModeRes>(bytes),
48 => ModelConvert.Decode<ResponseSetting>(bytes),
47 => ModelConvert.Decode<SetPeakValleyTime>(bytes),
49 => ModelConvert.Decode<InquireGatewaySpikesValleys>(bytes),
50 => ModelConvert.Decode<SdUpPkFtValSet>(bytes),
52 => ModelConvert.Decode<AuthVINRes>(bytes),
75 => ModelConvert.Decode<UploadModuleStatus>(bytes),
81 => ModelConvert.Decode<RemoteSignaling>(bytes),
82 => ModelConvert.Decode<BatteryPackData>(bytes),
83 => ModelConvert.Decode<BatteryPackDataVoltage>(bytes),
84 => ModelConvert.Decode<BatteryPackTotalElectricity>(bytes),
85 => ModelConvert.Decode<BatteryPackPortTemperature>(bytes),
86 => ModelConvert.Decode<BatteryPackStateAndFault>(bytes),
87 => ModelConvert.Decode<AcMeter>(bytes),
//83 => ModelConvert.Decode<QueryVersionRes>(bytes),
87 => ModelConvert.Decode<ElecMeterInfo>(bytes),
49 => ModelConvert.Decode<InquireGatewaySpikesValleys>(bytes),
47 => ModelConvert.Decode<SetPeakValleyTime>(bytes),
// 86 => ModelConvert.Decode<UploadUpgrade>(bytes),
_ => throw new InvalidOperationException("This should never be reached"),
},
#endregion

@ -0,0 +1,31 @@
using DotNetty.Transport.Channels;
using HybirdFrameworkCore.Autofac.Attribute;
using log4net;
using Service.Charger.Client;
using Service.Charger.Msg.Charger.Req;
using Service.Charger.Msg.Charger.Resp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Handler
{
/// <summary>
/// 3.5.19 充放电上报交流电表数据(交流电表接到充电机上的情况)
/// </summary>
public class AcMeterHandler: SimpleChannelInboundHandler<AcMeter>, IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(AcMeterHandler));
protected override void ChannelRead0(IChannelHandlerContext ctx, AcMeter msg)
{
if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
{
Log.Info($"receive {msg} from {sn}");
client.AcMeter = msg;
}
}
}
}

@ -0,0 +1,32 @@
using DotNetty.Transport.Channels;
using HybirdFrameworkCore.Autofac.Attribute;
using log4net;
using Service.Charger.Client;
using Service.Charger.Msg.Charger.Resp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Handler
{
/// <summary>
/// 3.5.17 充电机应答 VIN 鉴权结果
/// </summary>
[Order(8)]
[Scope("InstancePerDependency")]
internal class AuthVINResHandler : SimpleChannelInboundHandler<AuthVINRes>, IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(AuthVINResHandler));
protected override void ChannelRead0(IChannelHandlerContext ctx, AuthVINRes msg)
{
if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
{
Log.Info($"receive {msg} from {sn}");
}
}
}
}

@ -0,0 +1,32 @@
using DotNetty.Transport.Channels;
using HybirdFrameworkCore.Autofac.Attribute;
using log4net;
using Service.Charger.Client;
using Service.Charger.Msg.Charger.Resp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Handler
{
/// <summary>
/// 3.4.4 充放电设备应答辅助控制
/// </summary>
[Order(8)]
[Scope("InstancePerDependency")]
public class AuxiliaryPowerResHandler : SimpleChannelInboundHandler<AuxiliaryPowerRes>, IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(AuxiliaryPowerResHandler));
protected override void ChannelRead0(IChannelHandlerContext ctx, AuxiliaryPowerRes msg)
{
if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
{
Log.Info($"receive {msg} from {sn}");
client.AuxiliaryPowerRes = msg;
}
}
}
}

@ -0,0 +1,34 @@
using DotNetty.Transport.Channels;
using HybirdFrameworkCore.Autofac.Attribute;
using log4net;
using Service.Charger.Client;
using Service.Charger.Common;
using Service.Charger.Msg.Charger.Resp;
using Service.Charger.Msg.Host.Req;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Handler
{
/// <summary>
/// 3.4.2 充放电设备应答站功率调节指令
/// </summary>
[Order(8)]
[Scope("InstancePerDependency")]
public class PowerRegulationHandler : SimpleChannelInboundHandler<PowerRegulationRes>, IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(PowerRegulationHandler));
protected override void ChannelRead0(IChannelHandlerContext ctx, PowerRegulationRes msg)
{
if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
{
Log.Info($"receive {msg} from {sn}");
client.PowerRegulationRes = msg;
}
}
}
}

@ -0,0 +1,34 @@
using DotNetty.Transport.Channels;
using HybirdFrameworkCore.Autofac.Attribute;
using log4net;
using Service.Charger.Client;
using Service.Charger.Common;
using Service.Charger.Msg.Charger.Req;
using Service.Charger.Msg.Charger.Resp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Handler
{
/// <summary>
/// 电池包实时遥信上报(站内充电模式有电池包时周期性上传)
/// </summary>
[Order(8)]
[Scope("InstancePerDependency")]
public class RemoteSignalingHandler : SimpleChannelInboundHandler<RemoteSignaling>, IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(RemoteSignalingHandler));
protected override void ChannelRead0(IChannelHandlerContext ctx, RemoteSignaling msg)
{
if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
{
Log.Info($"receive {msg} from {sn}");
client.RemoteSignaling = msg;
}
}
}
}

@ -0,0 +1,37 @@
using DotNetty.Transport.Channels;
using HybirdFrameworkCore.Autofac.Attribute;
using log4net;
using Service.Charger.Client;
using Service.Charger.Msg.Charger.Req;
using Service.Charger.Msg.Charger.Resp;
using Service.Charger.Msg.Host.Resp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Handler
{
/// <summary>
/// 3.7 远程升级-监控网关上送升级完成确认帧
/// </summary>
[Order(8)]
[Scope("InstancePerDependency")]
public class UplinkUpgradeHandler : SimpleChannelInboundHandler<UplinkUpgrade>, IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(UplinkUpgradeHandler));
protected override void ChannelRead0(IChannelHandlerContext ctx, UplinkUpgrade msg)
{
if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
{
Log.Info($"receive {msg} from {sn}");
client.UplinkUpgrade = msg;
UplinkUpgradeRes uplinkUpgrade=new UplinkUpgradeRes();
ctx.Channel.WriteAsync(uplinkUpgrade);
}
}
}
}

@ -0,0 +1,33 @@
using DotNetty.Transport.Channels;
using HybirdFrameworkCore.Autofac.Attribute;
using log4net;
using Service.Charger.Client;
using Service.Charger.Msg.Charger.Req;
using Service.Charger.Msg.Charger.Resp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Handler
{
/// <summary>
/// 3.5.14 充电机上报车辆 VIN
/// </summary>
[Order(8)]
[Scope("InstancePerDependency")]
public class VehicleVINHandler : SimpleChannelInboundHandler<VehicleVIN>, IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(VehicleVINHandler));
protected override void ChannelRead0(IChannelHandlerContext ctx, VehicleVIN msg)
{
if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
{
Log.Info($"receive {msg} from {sn}");
client.VehicleVIN = msg;
}
}
}
}

@ -0,0 +1,57 @@
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Formats.Asn1.AsnWriter;
namespace Service.Charger.Msg.Charger.Req
{
/// <summary>
/// 3.5.19 充放电上报交流电表数据(交流电表接到充电机上的情况)
/// </summary>
public class AcMeter : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// 交流进线 A 相电压
/// </summary>
[Property(8, 16, scale: 0.1)]
public float PhaseVoltageA { get; set; }
/// <summary>
/// 交流进线 B 相电压
/// </summary>
[Property(24, 16, scale: 0.1)]
public float PhaseVoltageB { get; set; }
/// <summary>
/// 交流进线 C 相电压
/// </summary>
[Property(40, 16, scale: 0.1)]
public float PhaseVoltageC { get; set; }
/// <summary>
/// 交流进线 A 相电流
/// </summary>
[Property(56, 16, scale: 0.1)]
public float PhaseCurrentA { get; set; }
/// <summary>
/// 交流进线 B 相电流
/// </summary>
[Property(72, 16, scale: 0.1)]
public float PhaseCurrentB { get; set; }
/// <summary>
/// 交流进线 C 相电流
/// </summary>
[Property(88, 16, scale: 0.1)]
public float PhaseCurrentC { get; set; }
/// <summary>
/// 交流表总电量
/// </summary>
[Property(104, 32, scale: 0.1)]
public float AcMeterTotalPower { get; set; }
}
}

@ -0,0 +1,57 @@
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Formats.Asn1.AsnWriter;
namespace Service.Charger.Msg.Charger.Req
{
/// <summary>
/// 3.5.19 充放电上报交流电表数据(交流电表接到充电机上的情况)
/// </summary>
public class AcMeter : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// 交流进线 A 相电压
/// </summary>
[Property(8, 16, scale: 0.1)]
public float PhaseVoltageA { get; set; }
/// <summary>
/// 交流进线 B 相电压
/// </summary>
[Property(24, 16, scale: 0.1)]
public float PhaseVoltageB { get; set; }
/// <summary>
/// 交流进线 C 相电压
/// </summary>
[Property(40, 16, scale: 0.1)]
public float PhaseVoltageC { get; set; }
/// <summary>
/// 交流进线 A 相电流
/// </summary>
[Property(56, 16, scale: 0.1)]
public float PhaseCurrentA { get; set; }
/// <summary>
/// 交流进线 B 相电流
/// </summary>
[Property(72, 16, scale: 0.1)]
public float PhaseCurrentB { get; set; }
/// <summary>
/// 交流进线 C 相电流
/// </summary>
[Property(88, 16, scale: 0.1)]
public float PhaseCurrentC { get; set; }
/// <summary>
/// 交流表总电量
/// </summary>
[Property(104, 32, scale: 0.1)]
public float AcMeterTotalPower { get; set; }
}
}

@ -0,0 +1,252 @@
using HybirdFrameworkCore.Autofac.Attribute;
using Service.Charger.Common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static StackExchange.Redis.LCSMatchResult;
namespace Service.Charger.Msg.Charger.Req
{
/// <summary>
/// 3.5.8 电池包实时遥信上报(站内充电模式有电池包时周期性上传)
/// </summary>
public class RemoteSignaling : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// BMS 当前均衡状态 0不平衡 1平衡
/// </summary>
[Property(15, 1)]
public byte CurrentBMS { get; set; }
/// <summary>
/// 附件继电器状态 0开启 1闭合
/// </summary>
[Property(14, 1)]
public byte AttachmentRelayStatus { get; set; }
/// <summary>
/// BMS 当前状态
/// <para>0高压开启</para>
/// <para>1预先充电</para>
/// <para>2 高压关断</para>
/// <para>3 高压上电故障</para>
/// </summary>
[Property(12, 2)]
public byte CurrentStatusBMS { get; set; }
/// <summary>
/// B2V_ST1 的生命信 0~14 循环15:信号无效
/// </summary>
[Property(8, 4)]
public byte B2VST1Msg { get; set; }
/// <summary>
/// 保留
/// </summary>
[Property(23, 1)]
public byte Hold { get; set; }
/// <summary>
/// 最高报警等级
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2: 二级普通故障</para>
/// <para>3三级严重故障</para>
/// <para></para>
/// </summary>
[Property(21, 2)]
public byte MaximumAlarmLevel { get; set; }
/// <summary>
/// 充电状态
/// <para>0可以充电</para>
/// <para>1正在充电</para>
/// <para>2充电结束</para>
/// <para>3充电故障</para>
/// </summary>
[Property(19, 2)]
public byte ChargingState { get; set; }
/// <summary>
/// 充电模式
/// <para>0预留</para>
/// <para>1直流充电</para>
/// <para>2交流充电</para>
/// <para>3其他充电</para>
/// </summary>
[Property(17, 2)]
public byte ChargingMode { get; set; }
/// <summary>
/// 充电枪连接状态 0 未连接 1连接
/// </summary>
[Property(16, 1)]
public byte ConnectionStatus { get; set; }
/// <summary>
/// PACK 欠压报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(30, 2)]
public byte PackUndervoltage { get; set; }
/// <summary>
/// PACK 过压报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(28, 2)]
public byte PackOvervoltage { get; set; }
/// <summary>
/// 电芯温度过高报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(26, 2)]
public byte ExcessiveTemperature { get; set; }
/// <summary>
/// 电芯温差异常报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(24, 2)]
public byte AbnormalTemperatureDifference { get; set; }
/// <summary>
/// 绝缘报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(38, 2)]
public byte InsulationAlarm { get; set; }
/// <summary>
/// 单体电压欠压报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(36, 2)]
public byte UndervoltageAlarm { get; set; }
/// <summary>
/// 单体电压过高报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(34, 2)]
public byte VoltageTooHigh { get; set; }
/// <summary>
/// SOC过低报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(32, 2)]
public byte LowSOCAlarm { get; set; }
/// <summary>
/// 电芯温度过低报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(46, 2)]
public byte LowTemperature { get; set; }
/// <summary>
/// 放电电流过大报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(44, 2)]
public byte ExcessiveDischargeCurrent { get; set; }
/// <summary>
/// 充电电流过大报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(42, 2)]
public byte ExcessiveChargingCurrent { get; set; }
/// <summary>
/// 单体压差过大
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(40, 2)]
public byte IndividualPressureDifference { get; set; }
/// <summary>
/// BMS 系统不匹配报警 0正 常 1故障
/// </summary>
[Property(55, 1)]
public byte BMSSystemMismatchAlarm { get; set; }
/// <summary>
/// BMS 内部通讯故障 0正 常 1故障
/// </summary>
[Property(54, 1)]
public byte BMSCommunicationFailure { get; set; }
/// <summary>
/// SOC 跳变报警 0正 常 1故障
/// </summary>
[Property(53, 1)]
public byte SOCJumpAlarm { get; set; }
/// <summary>
/// SOC 过高报警
/// </summary>
[Property(52, 1)]
public byte SOCHighAlarm { get; set; }
/// <summary>
/// BMS 硬件故障
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(50, 2)]
public byte BMSHardwareFailure { get; set; }
/// <summary>
/// 支路压差过大报警(存在并联支路的系统)
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(48, 2)]
public byte BranchPressureDifference { get; set; }
/// <summary>
/// GBT32960.3 中规定的故障数目(当前时刻发生的) 0正常 1故障
/// </summary>
[Property(59, 5)]
public byte CurrentTimeOccurrence { get; set; }
/// <summary>
/// 火灾报警 0正常 1故障
/// </summary>
[Property(58, 1)]
public byte FireAlarm { get; set; }
/// <summary>
/// 烟雾报警 0正常 1故障
/// </summary>
[Property(57, 1)]
public byte SmokeAlarm { get; set; }
/// <summary>
/// 高压互锁报警 0正常 1故障
/// </summary>
[Property(56, 1)]
public byte HighVoltageInterlockAlarm { get; set; }
}
}

@ -0,0 +1,252 @@
using HybirdFrameworkCore.Autofac.Attribute;
using Service.Charger.Common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static StackExchange.Redis.LCSMatchResult;
namespace Service.Charger.Msg.Charger.Req
{
/// <summary>
/// 3.5.8 电池包实时遥信上报(站内充电模式有电池包时周期性上传)
/// </summary>
public class RemoteSignaling : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// BMS 当前均衡状态 0不平衡 1平衡
/// </summary>
[Property(15, 1)]
public byte CurrentBMS { get; set; }
/// <summary>
/// 附件继电器状态 0开启 1闭合
/// </summary>
[Property(14, 1)]
public byte AttachmentRelayStatus { get; set; }
/// <summary>
/// BMS 当前状态
/// <para>0高压开启</para>
/// <para>1预先充电</para>
/// <para>2 高压关断</para>
/// <para>3 高压上电故障</para>
/// </summary>
[Property(12, 2)]
public byte CurrentStatusBMS { get; set; }
/// <summary>
/// B2V_ST1 的生命信 0~14 循环15:信号无效
/// </summary>
[Property(8, 4)]
public byte B2VST1Msg { get; set; }
/// <summary>
/// 保留
/// </summary>
[Property(23, 1)]
public byte Hold { get; set; }
/// <summary>
/// 最高报警等级
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2: 二级普通故障</para>
/// <para>3三级严重故障</para>
/// <para></para>
/// </summary>
[Property(21, 2)]
public byte MaximumAlarmLevel { get; set; }
/// <summary>
/// 充电状态
/// <para>0可以充电</para>
/// <para>1正在充电</para>
/// <para>2充电结束</para>
/// <para>3充电故障</para>
/// </summary>
[Property(19, 2)]
public byte ChargingState { get; set; }
/// <summary>
/// 充电模式
/// <para>0预留</para>
/// <para>1直流充电</para>
/// <para>2交流充电</para>
/// <para>3其他充电</para>
/// </summary>
[Property(17, 2)]
public byte ChargingMode { get; set; }
/// <summary>
/// 充电枪连接状态 0 未连接 1连接
/// </summary>
[Property(16, 1)]
public byte ConnectionStatus { get; set; }
/// <summary>
/// PACK 欠压报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(30, 2)]
public byte PackUndervoltage { get; set; }
/// <summary>
/// PACK 过压报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(28, 2)]
public byte PackOvervoltage { get; set; }
/// <summary>
/// 电芯温度过高报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(26, 2)]
public byte ExcessiveTemperature { get; set; }
/// <summary>
/// 电芯温差异常报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(24, 2)]
public byte AbnormalTemperatureDifference { get; set; }
/// <summary>
/// 绝缘报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(38, 2)]
public byte InsulationAlarm { get; set; }
/// <summary>
/// 单体电压欠压报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(36, 2)]
public byte UndervoltageAlarm { get; set; }
/// <summary>
/// 单体电压过高报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(34, 2)]
public byte VoltageTooHigh { get; set; }
/// <summary>
/// SOC过低报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(32, 2)]
public byte LowSOCAlarm { get; set; }
/// <summary>
/// 电芯温度过低报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(46, 2)]
public byte LowTemperature { get; set; }
/// <summary>
/// 放电电流过大报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(44, 2)]
public byte ExcessiveDischargeCurrent { get; set; }
/// <summary>
/// 充电电流过大报警
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(42, 2)]
public byte ExcessiveChargingCurrent { get; set; }
/// <summary>
/// 单体压差过大
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(40, 2)]
public byte IndividualPressureDifference { get; set; }
/// <summary>
/// BMS 系统不匹配报警 0正 常 1故障
/// </summary>
[Property(55, 1)]
public byte BMSSystemMismatchAlarm { get; set; }
/// <summary>
/// BMS 内部通讯故障 0正 常 1故障
/// </summary>
[Property(54, 1)]
public byte BMSCommunicationFailure { get; set; }
/// <summary>
/// SOC 跳变报警 0正 常 1故障
/// </summary>
[Property(53, 1)]
public byte SOCJumpAlarm { get; set; }
/// <summary>
/// SOC 过高报警
/// </summary>
[Property(52, 1)]
public byte SOCHighAlarm { get; set; }
/// <summary>
/// BMS 硬件故障
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(50, 2)]
public byte BMSHardwareFailure { get; set; }
/// <summary>
/// 支路压差过大报警(存在并联支路的系统)
/// <para>0无故障</para>
/// <para>1一级报警故障</para>
/// <para>2二级普通故障</para>
/// <para>3三级严重故障</para>
/// </summary>
[Property(48, 2)]
public byte BranchPressureDifference { get; set; }
/// <summary>
/// GBT32960.3 中规定的故障数目(当前时刻发生的) 0正常 1故障
/// </summary>
[Property(59, 5)]
public byte CurrentTimeOccurrence { get; set; }
/// <summary>
/// 火灾报警 0正常 1故障
/// </summary>
[Property(58, 1)]
public byte FireAlarm { get; set; }
/// <summary>
/// 烟雾报警 0正常 1故障
/// </summary>
[Property(57, 1)]
public byte SmokeAlarm { get; set; }
/// <summary>
/// 高压互锁报警 0正常 1故障
/// </summary>
[Property(56, 1)]
public byte HighVoltageInterlockAlarm { get; set; }
}
}

@ -0,0 +1,61 @@
using AutoMapper.Execution;
using HybirdFrameworkCore.Autofac.Attribute;
using Service.Charger.Msg.Host.Req;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Charger.Req
{
/// <summary>
/// 3.7 远程升级-监控网关上送升级完成确认帧
/// </summary>
public class UplinkUpgrade : ASDU
{ /// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// 当前版本号
/// </summary>
[Property(8, 8)]
public byte CurrentVersionNumberByte1 { get; set; }
[Property(16, 8)]
public byte CurrentVersionNumberByte2 { get; set; }
[Property(24, 8)]
public byte CurrentVersionNumberByte3 { get; set; }
public string CurrentVersionNumber
{
get
{
return CurrentVersionNumberByte1 + "." + CurrentVersionNumberByte2 + "." + CurrentVersionNumberByte3;
}
set { }
}
/// <summary>
/// 原来版本号
/// </summary>
[Property(32, 8)]
public byte OriginalVersionNumberByte1 { get; set; }
[Property(40, 8)]
public byte OriginalVersionNumberByte2 { get; set; }
[Property(48, 8)]
public byte OriginalVersionNumberByte3 { get; set; }
public string OriginalVersionNumber
{
get
{
return OriginalVersionNumberByte1 + "." + OriginalVersionNumberByte2 + "." + OriginalVersionNumberByte3;
}
set { }
}
/// <summary>
/// 升级结果 0: 成功; 1: 失败
/// </summary>
[Property(56, 32)]
public uint UpgradeResultByte { get; set; }
}
}

@ -0,0 +1,26 @@
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Charger.Req
{
/// <summary>
/// 3.5.14 充电机上报车辆 VIN
/// </summary>
public class VehicleVIN : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// VIN
/// </summary>
[Property(8, 17, type: PropertyReadConstant.Byte)]
public string vin { get; set; }
}
}

@ -0,0 +1,26 @@
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Charger.Req
{
/// <summary>
/// 3.5.14 充电机上报车辆 VIN
/// </summary>
public class VehicleVIN : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// VIN
/// </summary>
[Property(8, 17, type: PropertyReadConstant.Byte)]
public string vin { get; set; }
}
}

@ -0,0 +1,22 @@
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Charger.Resp
{
/// <summary>
/// 3.5.17 充电机应答 VIN 鉴权结果
/// </summary>
public class AuthVINRes : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
}
}

@ -1,16 +0,0 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.Charger.Msg.Charger.Resp
{
/// <summary>
/// 3.4.8 充放电机应答监控平台下发站外允许充电 SOC
/// </summary>
public class ChargingSOC
{
/// <summary>
/// 0 成功 1 失败
/// </summary>
[Property(0, 8)]
public byte Result { get; set; }
}
}

@ -1,28 +0,0 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.Charger.Msg.Charger.Resp
{
/// <summary>
/// 3.4.2 充放电机应答站功率调节指令
/// </summary>
public class ChargingPowerRegulationRes : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
///应答结果 0: 成功 1失败
/// </summary>
[Property(8, 8)]
public byte Result { get; set; }
/// <summary>
///失败原因 0正常 1参数非法 2双向充电设备放电中 0xFF:其他原因
/// </summary>
[Property(16, 8)]
public byte FailReason { get; set; }
}
}

@ -0,0 +1,36 @@
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Charger.Resp
{
/// <summary>
/// 3.4.2 充放电设备应答站功率调节指令
/// </summary>
public class PowerRegulationRes : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// 应答结果 0: 成功 1失败
/// </summary>
[Property(8, 8)]
public byte ResponseResult { get; set; }
/// <summary>
/// 失败原因
/// <para>0正常</para>
/// <para>1参数非法</para>
/// <para>2双向充电设备放电中</para>
/// <para>0xFF:其他原因</para>
/// </summary>
[Property(16, 8)]
public ushort CauseFailure { get; set; }
}
}

@ -0,0 +1,35 @@
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Charger.Resp
{
/// <summary>
/// 3.4.2 充放电设备应答站功率调节指令
/// </summary>
public class PowerRegulationRes : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// 应答结果 0: 成功 1失败
/// </summary>
[Property(8, 8)]
public byte ResponseResult { get; set; }
/// <summary>
/// 失败原因
/// <para>0正常</para>
/// <para>1参数非法</para>
/// <para>2双向充电设备放电中</para>
/// <para>0xFF:其他原因</para>
/// </summary>
[Property(16, 8)]
public ushort CauseFailure { get; set; }
}
}

@ -0,0 +1,31 @@
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Charger.Resp
{
/// <summary>
/// 3.7 远程升级-监控网关响应升级请求
/// </summary>
public class UpgradeRequestRes : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// 应答结果
/// </summary>
public byte ResponseResult { get; set; }
/// <summary>
/// 失败原因
/// </summary>
public byte CauseFailure { get; set; }
}
}

@ -16,10 +16,10 @@ namespace Service.Charger.Msg.Host.Req
/// <summary>
///期望运行 功率
/// </summary>
[Property(8, 16, PropertyReadConstant.Bit, 0.1, 1)]
public float ChargeRate { get; set; }
[Property(8, 16, scale: 0.1)]
public float ExpectedOperatingPower { get; set; }
public AdjustChargeRate(float chargeRate)
public AdjustChargeRate(float expectedOperatingPower)
{
FrameTypeNo = 45;
MsgBodyCount = 1;
@ -28,7 +28,7 @@ namespace Service.Charger.Msg.Host.Req
MsgBodyAddr = new byte[] { 0, 0, 0 };
RecordType = 20;
ChargeRate = chargeRate;
ExpectedOperatingPower = expectedOperatingPower;
}
}
}

@ -0,0 +1,44 @@
using DotNetty.Codecs.Mqtt.Packets;
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Host.Req
{
/// <summary>
/// 3.5.16 站控下发 VIN 鉴权的结果
/// </summary>
public class AuthenticationVIN:ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// VIN 鉴权结果 1:通过 2 不通过
/// </summary>
[Property(8, 8)]
public byte VINResult { get; set; }
public AuthenticationVIN(byte vinresult)
{
PackLen = 0;
CtlArea = 0;
SrcAddr = 0;
FrameTypeNo = 45;
MsgBodyCount = 1;
TransReason = 3;
PublicAddr = 4;
MsgBodyAddr = new byte[] { 0, 0, 0 };
RecordType = 51;
VINResult = vinresult;
}
}
}

@ -0,0 +1,48 @@
using DotNetty.Codecs.Mqtt.Packets;
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Host.Req
{
/// <summary>
/// 3.5.16 站控下发 VIN 鉴权的结果
/// </summary>
public class AuthenticationVIN:ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// VIN 鉴权结果 1:通过 2 不通过
/// </summary>
[Property(8, 8)]
public byte VINResult { get; set; }
/// <summary>
/// 站控下发 VIN 鉴权的结果
/// </summary>
/// <param name="vinresult">VIN 鉴权结果 1:通过 2 不通过</param>
public AuthenticationVIN(byte vinresult)
{
PackLen = 0;
CtlArea = 0;
SrcAddr = 0;
FrameTypeNo = 45;
MsgBodyCount = 1;
TransReason = 3;
PublicAddr = 4;
MsgBodyAddr = new byte[] { 0, 0, 0 };
RecordType = 51;
VINResult = vinresult;
}
}
}

@ -8,9 +8,31 @@ namespace Service.Charger.Msg.Host.Req
public class AuxiliaryPower : ASDU
{
/// <summary>
///打开辅助电源标志 1电池包辅助电源导通 0电池包辅助电源断开
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
///打开辅助电源标志 1电池包辅助电源导通 0电池包辅助电源断开
/// </summary>
[Property(8, 8)]
public byte OpenFlag { get; set; }
public AuxiliaryPower(byte openFlag)
{
PackLen = 0;
CtlArea = 0;
SrcAddr = 0;
FrameTypeNo = 45;
MsgBodyCount = 1;
TransReason = 3;
PublicAddr = 0;
MsgBodyAddr = new byte[] { 0, 0, 0 };
RecordType = 9;
OpenFlag = openFlag;
}
}
}

@ -0,0 +1,62 @@
using DotNetty.Codecs.Mqtt.Packets;
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Host.Req
{
/// <summary>
/// 3.5.5 监控平台下发电池仓的状态
/// </summary>
public class BatteryHolderStatus:ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// 是否有电池 0:无电池 1有电池
/// </summary>
[Property(8, 8)]
public byte Battery { get; set; }
/// <summary>
/// 电接头连接状态 0:未连接 1: 已连接
/// </summary>
[Property(16, 8)]
public byte ConnectionState { get; set; }
/// <summary>
/// 水接头状态 0:未连接 1: 已连接
/// </summary>
[Property(24, 8)]
public byte WaterCondition { get; set; }
/// <summary>
///
/// </summary>
/// <param name="Battery"></param>
/// <param name="ConnectionState"></param>
/// <param name="WaterCondition"></param>
public BatteryHolderStatus(byte battery, byte connectionState, byte waterCondition)
{
PackLen = 0;
CtlArea = 0;
SrcAddr = 0;
FrameTypeNo = 45;
MsgBodyCount = 1;
TransReason = 3;
PublicAddr = 0;
MsgBodyAddr = new byte[] { 0, 0, 0 };
RecordType = 15;
Battery = battery;
ConnectionState = connectionState;
WaterCondition = waterCondition;
}
}
}

@ -0,0 +1,62 @@
using DotNetty.Codecs.Mqtt.Packets;
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Host.Req
{
/// <summary>
/// 3.5.5 监控平台下发电池仓的状态
/// </summary>
public class BatteryHolderStatus:ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// 是否有电池 0:无电池 1有电池
/// </summary>
[Property(8, 8)]
public byte Battery { get; set; }
/// <summary>
/// 电接头连接状态 0:未连接 1: 已连接
/// </summary>
[Property(16, 8)]
public byte ConnectionState { get; set; }
/// <summary>
/// 水接头状态 0:未连接 1: 已连接
/// </summary>
[Property(24, 8)]
public byte WaterCondition { get; set; }
/// <summary>
///
/// </summary>
/// <param name="battery">是否有电池 0:无电池 1有电池</param>
/// <param name="connectionState">电接头连接状态 0:未连接 1: 已连接</param>
/// <param name="waterCondition">水接头状态 0:未连接 1: 已连接</param>
public BatteryHolderStatus(byte battery, byte connectionState, byte waterCondition)
{
PackLen = 0;
CtlArea = 0;
SrcAddr = 0;
FrameTypeNo = 45;
MsgBodyCount = 1;
TransReason = 3;
PublicAddr = 0;
MsgBodyAddr = new byte[] { 0, 0, 0 };
RecordType = 15;
Battery = battery;
ConnectionState = connectionState;
WaterCondition = waterCondition;
}
}
}

@ -1,40 +0,0 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.Charger.Msg.Host.Req.Bms
{
/// <summary>
/// 3.4.1 监控平台发送功率调节指令
/// </summary>
public class QueryBattery : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// 记录类型
/// </summary>
[Property(8, 3, PropertyReadConstant.Byte)]
public byte[] Pgn { get; set; } = { 0x00, 0xf8, 0x2c };
/// <summary>
/// 记录类型
/// </summary>
[Property(32, 3, PropertyReadConstant.Byte)]
public byte[] QueryPgn { get; set; }
public QueryBattery(byte[] queryPgn)
{
FrameTypeNo = 46;
MsgBodyCount = 1;
TransReason = 3;
PublicAddr = 0;
MsgBodyAddr = new byte[] { 0, 0, 0 };
RecordType = 80;
QueryPgn = queryPgn;
}
}
}

@ -0,0 +1,44 @@
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Host.Req
{
/// <summary>
/// 3.4.1 监控平台发送功率调节指令
/// </summary>
public class PowerRegulation : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// 期望运行功率
/// </summary>
[Property(8, 16, scale: 0.1)]
public ushort ExpectedOperatingPower { get; set; }
public PowerRegulation(ushort expectedOperatingPower)
{
PackLen = 0;
CtlArea = 0;
SrcAddr = 0;
FrameTypeNo = 45;
MsgBodyCount = 1;
TransReason = 3;
PublicAddr = 0;
MsgBodyAddr = new byte[] { 0, 0, 0 };
RecordType = 5;
ExpectedOperatingPower = expectedOperatingPower;
}
}
}

@ -0,0 +1,45 @@
using HslCommunication.BasicFramework;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Host.Req
{
/// <summary>
/// 3.7 远程升级-站级监控升级请求下发
/// </summary>
public class Upgrade_request : ASDU
{
/// <summary>
/// 执行控制 0x01立即执行 0x02空闲执行
/// </summary>
public byte ExecutionControl { get; set; }
/// <summary>
/// 下 载 超 时时间
/// </summary>
public byte DownloadTimeout { get; set; }
/// <summary>
/// 版本号 ASCII 码
/// </summary>
public string VersionNumber { get; set; }
/// <summary>
/// 文件名称 HEX
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 文件大小 HEX
/// </summary>
public string fileSize { get; set; }
/// <summary>
/// MD5 校验值 HEX
/// </summary>
public string MD5Verification { get; set; }
/// <summary>
/// URL文件路径ASCII码
/// </summary>
public string URL { get; set; }
}
}

@ -0,0 +1,115 @@
using HslCommunication.BasicFramework;
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Host.Req
{
/// <summary>
/// 3.7 远程升级-站级监控升级请求下发
/// </summary>
public class UpgradeRequest : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// 执行控制 0x01立即执行 0x02空闲执行
/// </summary>
[Property(8, 8)]
public byte ExecutionControl { get; set; }
/// <summary>
/// 下载超时时间
/// </summary>
[Property(16, 16)]
public byte DownloadTimeout { get; set; }
/// <summary>
/// 版本号 ASCII 码
/// </summary>
[Property(32, 24)]
public string VersionNumber { get; set; }
/// <summary>
/// 文件名称 HEX
/// </summary>
[Property(56, 160)]
public byte[] FileNameByte
{
get
{
return Enumerable.Range(0, FileName.Length / 2)
.Select(i => Convert.ToByte(FileName.Substring(i * 2, 2), 16))
.ToArray();
}
set { }
}
/// <summary>
/// 文件名称 HEX
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 文件大小 HEX
/// </summary>
[Property(216, 32)]
public uint FileSize { get; set; }
/// <summary>
/// MD5校验值 HEX
/// </summary>
[Property(248, 128)]
public byte[] MD5VerificationByte
{
get
{
return Enumerable.Range(0, MD5Verification.Length / 2)
.Select(i => Convert.ToByte(MD5Verification.Substring(i * 2, 2), 16))
.ToArray();
}
set { }
}
public string MD5Verification { get; set; }
/// <summary>
/// URL文件路径ASCII码
/// </summary>
[Property(376, 1600)]
public string URL { get; set; }
/// <summary>
///
/// </summary>
/// <param name="executionControl">执行控制 0x01立即执行 0x02空闲执行</param>
/// <param name="downloadTimeout">下载超时时间</param>
/// <param name="versionNumber">版本号</param>
/// <param name="fileName">文件名称</param>
/// <param name="fileSize">文件大小</param>
/// <param name="mD5Verification">MD5校验值</param>
/// <param name="url">URL文件路径</param>
public UpgradeRequest(byte executionControl, byte downloadTimeout, string versionNumber,
string fileName, uint fileSize, string mD5Verification, string url)
{
PackLen = 0;
CtlArea = 0;
SrcAddr = 0;
FrameTypeNo = 45;
MsgBodyCount = 1;
TransReason = 3;
PublicAddr = 0;
MsgBodyAddr = new byte[] { 0, 0, 0 };
RecordType = 33;
ExecutionControl = executionControl;
DownloadTimeout = downloadTimeout;
VersionNumber = versionNumber;
FileName = fileName;
FileSize = fileSize;
MD5Verification = mD5Verification;
URL = url;
}
}
}

@ -0,0 +1,44 @@
using DotNetty.Codecs.Mqtt.Packets;
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Host.Resp
{
/// <summary>
/// 3.7 远程升级-站级监控响应升级完成确认帧
/// </summary>
public class UplinkUpgradeRes : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
/// <summary>
/// 应答结果 默认 0
/// </summary>
public byte ResponseResult { get; set; }
public UplinkUpgradeRes()
{
PackLen = 0;
CtlArea = 0;
SrcAddr = 0;
FrameTypeNo = 45;
MsgBodyCount = 1;
TransReason = 3;
PublicAddr = 0;
MsgBodyAddr = new byte[] { 0, 0, 0 };
RecordType = 36;
RecordType = 0;
}
}
}

@ -0,0 +1,36 @@
using HybirdFrameworkCore.Autofac.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg.Host.Resp
{
/// <summary>
/// 3.5.15 站控应该充电机 VIN 上报响应
/// </summary>
public class VehicleVINRes : ASDU
{
/// <summary>
/// 记录类型
/// </summary>
[Property(0, 8)]
public byte RecordType { get; set; }
public VehicleVINRes()
{
PackLen = 0;
CtlArea = 0;
SrcAddr = 0;
FrameTypeNo = 45;
MsgBodyCount = 1;
TransReason = 3;
PublicAddr = 0;
MsgBodyAddr = new byte[] { 0, 0, 0 };
RecordType = 41;
}
}
}

@ -7,21 +7,21 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNetty.Buffers" Version="0.7.5"/>
<PackageReference Include="DotNetty.Codecs" Version="0.7.5"/>
<PackageReference Include="DotNetty.Codecs.Mqtt" Version="0.7.5"/>
<PackageReference Include="DotNetty.Common" Version="0.7.5"/>
<PackageReference Include="DotNetty.Handlers" Version="0.7.5"/>
<PackageReference Include="DotNetty.Transport" Version="0.7.5"/>
<PackageReference Include="log4net" Version="2.0.15"/>
<PackageReference Include="SqlSugarCore" Version="5.1.4.115"/>
<PackageReference Include="DotNetty.Buffers" Version="0.7.5" />
<PackageReference Include="DotNetty.Codecs" Version="0.7.5" />
<PackageReference Include="DotNetty.Codecs.Mqtt" Version="0.7.5" />
<PackageReference Include="DotNetty.Common" Version="0.7.5" />
<PackageReference Include="DotNetty.Handlers" Version="0.7.5" />
<PackageReference Include="DotNetty.Transport" Version="0.7.5" />
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.115" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HybirdFrameworkCore\HybirdFrameworkCore.csproj"/>
<ProjectReference Include="..\HybirdFrameworkDriver\HybirdFrameworkDriver.csproj"/>
<ProjectReference Include="..\Entity\Entity.csproj"/>
<ProjectReference Include="..\Repository\Repository.csproj"/>
<ProjectReference Include="..\HybirdFrameworkCore\HybirdFrameworkCore.csproj" />
<ProjectReference Include="..\HybirdFrameworkDriver\HybirdFrameworkDriver.csproj" />
<ProjectReference Include="..\Entity\Entity.csproj" />
<ProjectReference Include="..\Repository\Repository.csproj" />
</ItemGroup>
</Project>

Loading…
Cancel
Save