diff --git a/HybirdFrameworkCore/Utils/BitUtls.cs b/HybirdFrameworkCore/Utils/BitUtls.cs index 075bb4c..c02d181 100644 --- a/HybirdFrameworkCore/Utils/BitUtls.cs +++ b/HybirdFrameworkCore/Utils/BitUtls.cs @@ -61,6 +61,7 @@ public static class BitUtls { length = length / 8; var bt = new byte[length]; + start = start / 8; for (var i = start; i < start + length; i++) bt[i - start] = bytes[i]; diff --git a/Service/Charger/Codec/Decoder.cs b/Service/Charger/Codec/Decoder.cs index 3709a4a..a29420e 100644 --- a/Service/Charger/Codec/Decoder.cs +++ b/Service/Charger/Codec/Decoder.cs @@ -19,8 +19,8 @@ public class Decoder : ByteToMessageDecoder { private static readonly ILog Log = LogManager.GetLogger(typeof(Decoder)); - - private readonly IByteBuffer[] _delimiters = { Unpooled.CopiedBuffer(ChargerConst.StartChar) }; + + private readonly IByteBuffer[] _delimiters = { Unpooled.CopiedBuffer(ChargerConst.StartChar) }; protected override void Decode(IChannelHandlerContext context, IByteBuffer buffer, List output) { @@ -100,16 +100,16 @@ public class Decoder : ByteToMessageDecoder return -1; } - public ASDU Parse(IByteBuffer byteBuffer, int totalFrameLength, out byte[] data) + public ASDU Parse(IByteBuffer byteBuffer, int totalFrameLength, out byte[] data) { data = new byte[totalFrameLength]; byteBuffer.ReadBytes(data); - //string ou = string.Empty; - //for (int i = 0; i < data.Length; i++) - //{ - // ou += data[i].ToString("X2") + " "; - //} + string ou = string.Empty; + for (int i = 0; i < data.Length; i++) + { + ou += data[i].ToString("X2") + " "; + } //TODO bug length取值不对,上述测试使用 int removeIndex = _delimiters.Length; @@ -136,11 +136,9 @@ public class Decoder : ByteToMessageDecoder 41 => ModelConvert.Decode(bytes), 44 => ModelConvert.Decode(bytes), 48 => ModelConvert.Decode(bytes), - 47 => ModelConvert.Decode(bytes), - 49 => ModelConvert.Decode(bytes), - 50 => ModelConvert.Decode(bytes), + 50 => ModelConvert.Decode(bytes), 52 => ModelConvert.Decode(bytes), - 75 => ModelConvert.Decode(bytes), + //75 => ModelConvert.Decode(bytes), 80 => ModelConvert.Decode(bytes), 81 => ModelConvert.Decode(bytes), 82 => ModelConvert.Decode(bytes), @@ -214,7 +212,12 @@ public class Decoder : ByteToMessageDecoder 57 => ModelConvert.Decode(bytes), 58 => ModelConvert.Decode(bytes), 59 => ModelConvert.Decode(bytes), + 60 => ModelConvert.Decode(bytes), + 61 => ModelConvert.Decode(bytes), 62 => ModelConvert.Decode(bytes), + 65 => ModelConvert.Decode(bytes), + 66 => ModelConvert.Decode(bytes), + 72 => ModelConvert.Decode(bytes), 81 => ModelConvert.Decode(bytes), 142 => ModelConvert.Decode(bytes), 143 => ModelConvert.Decode(bytes), diff --git a/Service/Charger/Handler/BasicParameterHandler.cs b/Service/Charger/Handler/BasicParameterHandler.cs new file mode 100644 index 0000000..f0a3af7 --- /dev/null +++ b/Service/Charger/Handler/BasicParameterHandler.cs @@ -0,0 +1,28 @@ +using DotNetty.Transport.Channels; +using log4net; +using Service.Charger.Client; +using Service.Charger.Msg.Charger.Req; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Service.Charger.Handler +{ + /// + /// 3.6.2.2 充放电机上传基本参数 2(PGN:0x00F802) + /// + public class BasicParameterHandler : SimpleChannelInboundHandler, IBaseHandler + { + private static readonly ILog Log = LogManager.GetLogger(typeof(BasicParameterHandler)); + + protected override void ChannelRead0(IChannelHandlerContext ctx, BasicParameter msg) + { + if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client)) + { + Log.Info($"receive {msg} from {sn}"); + } + } + } +} diff --git a/Service/Charger/Handler/DetectionpointextremumdataHandler.cs b/Service/Charger/Handler/DetectionpointextremumdataHandler.cs new file mode 100644 index 0000000..25ef401 --- /dev/null +++ b/Service/Charger/Handler/DetectionpointextremumdataHandler.cs @@ -0,0 +1,28 @@ +using DotNetty.Transport.Channels; +using log4net; +using Service.Charger.Client; +using Service.Charger.Msg.Charger.Req; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Service.Charger.Handler +{ + /// + /// + /// + public class DetectionpointextremumdataHandler : SimpleChannelInboundHandler, IBaseHandler + { + private static readonly ILog Log = LogManager.GetLogger(typeof(DetectionpointextremumdataHandler)); + + protected override void ChannelRead0(IChannelHandlerContext ctx, Detectionpointextremumdata msg) + { + if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client)) + { + Log.Info($"receive {msg} from {sn}"); + } + } + } +} diff --git a/Service/Charger/Handler/HeartBeatHandler.cs b/Service/Charger/Handler/HeartBeatHandler.cs index 9744d43..caff056 100644 --- a/Service/Charger/Handler/HeartBeatHandler.cs +++ b/Service/Charger/Handler/HeartBeatHandler.cs @@ -27,10 +27,6 @@ namespace Service.Charger.Handler HeartBeatRes heartBeatRes = new HeartBeatRes(0); ctx.Channel.WriteAndFlushAsync(heartBeatRes); } - else - { - client.ChargingStatus = (int)ChargingStatus.StartChargingFailed; - } } } } diff --git a/Service/Charger/Handler/UpAlarmHandler.cs b/Service/Charger/Handler/UpAlarmHandler.cs new file mode 100644 index 0000000..b210823 --- /dev/null +++ b/Service/Charger/Handler/UpAlarmHandler.cs @@ -0,0 +1,28 @@ +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 +{ + [Order(8)] + [Scope("InstancePerDependency")] + public class UpAlarmHandler : SimpleChannelInboundHandler, IBaseHandler + { + private static readonly ILog Log = LogManager.GetLogger(typeof(UpAlarmHandler)); + + protected override void ChannelRead0(IChannelHandlerContext ctx, UpAlarm msg) + { + if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client)) + { + Log.Info($"receive {msg} from {sn}"); + } + } + } +} diff --git a/Service/Charger/Handler/UpgradeRequestHandler.cs b/Service/Charger/Handler/UpgradeRequestHandler.cs new file mode 100644 index 0000000..1dd963a --- /dev/null +++ b/Service/Charger/Handler/UpgradeRequestHandler.cs @@ -0,0 +1,34 @@ +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.Req; +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 +{ + /// + /// + /// + [Order(8)] + [Scope("InstancePerDependency")] + public class UpgradeRequestHandler : SimpleChannelInboundHandler, IBaseHandler + { + private static readonly ILog Log = LogManager.GetLogger(typeof(UpgradeRequestHandler)); + + protected override void ChannelRead0(IChannelHandlerContext ctx, UpgradeRequestRes msg) + { + if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client)) + { + Log.Info($"receive {msg} from {sn}"); + } + } + } +} diff --git a/Service/Charger/Handler/VoltageExtremumStatisticsHandler.cs b/Service/Charger/Handler/VoltageExtremumStatisticsHandler.cs new file mode 100644 index 0000000..d7b2f59 --- /dev/null +++ b/Service/Charger/Handler/VoltageExtremumStatisticsHandler.cs @@ -0,0 +1,29 @@ +using DotNetty.Transport.Channels; +using HybirdFrameworkCore.Autofac.Attribute; +using log4net; +using Service.Charger.Client; +using Service.Charger.Msg.Charger.Req; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Service.Charger.Handler +{ + [Order(8)] + [Scope("InstancePerDependency")] + public class VoltageExtremumStatisticsHandler : SimpleChannelInboundHandler, IBaseHandler + { + private readonly ILog Log = LogManager.GetLogger(typeof(VoltageExtremumStatisticsHandler)); + + protected override void ChannelRead0(IChannelHandlerContext ctx, VoltageExtremumStatistics msg) + { + + if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client)) + { + Log.Info($"receive {msg} from {sn}"); + } + } + } +} diff --git a/Service/Charger/Msg/Charger/Req/BasicParameter.cs b/Service/Charger/Msg/Charger/Req/BasicParameter.cs new file mode 100644 index 0000000..c603155 --- /dev/null +++ b/Service/Charger/Msg/Charger/Req/BasicParameter.cs @@ -0,0 +1,94 @@ +using AutoMapper.Execution; +using HybirdFrameworkCore.Autofac.Attribute; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static COSXML.Model.Tag.ListBucketVersions; + +namespace Service.Charger.Msg.Charger.Req +{ + /// + /// 3.6.2.2 充放电机上传基本参数 2(PGN:0x00F802) + /// + public class BasicParameter : ASDU + { + /// + /// 记录类型 + /// + [Property(0, 8)] + public byte RecordType { get; set; } + /// + /// PGN 码 + /// + [Property(8, 8)] + public byte Pgn1 { get; set; } + [Property(16, 8)] + public byte Pgn2 { get; set; } + [Property(24, 8)] + public byte Pgn3 { get; set; } + /// + /// 电池编码 + /// + public byte BatteryCode { get; set; } + /// + /// 产权标识 + /// + public byte TitleMarke { get; set; } + /// + /// 电池成组厂商 + /// + public byte Batterymanufacturers { get; set; } + /// + /// 电池成组生产日期:年 + /// + public byte GroupYear { get; set; } + /// + /// 电池成组生产日期:月 + /// + public byte GroupMonth { get; set; } + /// + /// 电池成组生产日期:日 + /// + public byte GroupDay { get; set; } + /// + /// 电池电芯生产厂商 + /// + public byte BatteryManufacturer { get; set; } + /// + /// 电池电芯生产日期:年 + /// + public byte CellYear { get; set; } + /// + /// 电池电芯生产日期:月 + /// + public byte CellMonth { get; set; } + /// + /// 电池电芯生产日期:日 + /// + public byte CellDay { get; set; } + /// + /// 电池箱电子控制单元生产厂商 + /// + public byte Manufacturer { get; set; } + /// + /// 电池箱电子控制单元硬件版本 + /// + public byte HardwareVersion { get; set; } + /// + /// 电池箱电子控制单元软件版本 + /// + public byte SoftwareVersion { get; set; } + /// + /// 电池包序列号 + /// + public byte SerialNumber { get; set; } + /// + /// 电池包型号 + /// + public byte ModelNumber { get; set; } + + + } +} diff --git a/Service/Charger/Msg/Charger/Req/Detectionpointextremumdata.cs b/Service/Charger/Msg/Charger/Req/Detectionpointextremumdata.cs new file mode 100644 index 0000000..ae17bc9 --- /dev/null +++ b/Service/Charger/Msg/Charger/Req/Detectionpointextremumdata.cs @@ -0,0 +1,78 @@ +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 +{ + /// + /// 3.6.1.5 充放电机上传温度检测点极值数据(PGN:0x00F823) + /// + public class Detectionpointextremumdata : ASDU + { + /// + /// 记录类型 + /// + [Property(0, 8)] + public byte RecordType { get; set; } + /// + /// PGN 码 + /// + [Property(8, 8)] + public byte Pgn1 { get; set; } + [Property(16, 8)] + public byte Pgn2 { get; set; } + [Property(24, 8)] + public byte Pgn3 { get; set; } + /// + /// 最高温度 + /// 分辨率:1℃/位,偏移量:-50℃,数值范围:-50℃~200℃ + /// + [Property(32, 8, offset: 50)] + public int MaximumTemp { get; set; } + /// + /// 最高温度检测点编号 + /// 分辨率:1/位,偏移量:0,数值范围1~250 + /// + [Property(40, 8)] + public byte MaximumTempNum { get; set; } + /// + /// 最低温度 + /// 分辨率:1℃/位,偏移量:-50℃,数值范围:-50℃~200℃ + /// + [Property(48, 8, offset: 50)] + public int MinimumTemp { get; set; } + /// + /// 最低温度检测点编号 + /// 分辨率:1℃/位,偏移量:0,数值范围:1~250 + /// + [Property(56, 8, offset: 50)] + public int MinimumTempNum { get; set; } + /// + /// 连接器总正极柱温度 + /// 分辨率:1℃/位,偏移量:-50℃,数值范围:-50℃~200℃ + /// + [Property(64, 8, offset: 50)] + public int PositiveTemp { get; set; } + /// + /// 连接器总负极柱温度 + /// 分辨率:1℃/位,偏移量:-50℃,数值范围:-50℃~200℃ + /// + [Property(72, 8, offset: 50)] + public int NegativeTemp { get; set; } + /// + /// 单体平均温度 + /// 分辨率:1℃/位,偏移量:-50℃,数值范围:-50℃~200℃ + /// + [Property(80, 8, offset: 50)] + public int MonomerMeantemp { get; set; } + /// + /// 保留 + /// + [Property(88, 8)] + public byte Reserve { get; set; } + } +} diff --git a/Service/Charger/Msg/Charger/Req/RealDataReporting.cs b/Service/Charger/Msg/Charger/Req/RealDataReporting.cs new file mode 100644 index 0000000..72a7fc2 --- /dev/null +++ b/Service/Charger/Msg/Charger/Req/RealDataReporting.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Service.Charger.Msg.Charger.Req +{ + /// + /// 3.5.9 电池包实时数据上报(站内充电模式有电池包时周期性上传) + /// + public class RealDataReporting:ASDU + { + //TODO + /* +电池包 SOC +电池包 SOH +电池包总电流,充电为负值,放电为正值 +电池包允许最大回充电电流值(脉冲) +电池包允许最大放电电流值(脉冲) +电池包正极绝缘值 +电池包负极绝缘值 +电池端高压(主继电器内侧) +母线端高压(主继电器外侧) + +SOC +SOH +Total +Charging +Discharge +Positive +Negative +Battery +voltage + */ + } +} diff --git a/Service/Charger/Msg/Charger/Req/RecordCharge.cs b/Service/Charger/Msg/Charger/Req/RecordCharge.cs index 0993ee2..923b464 100644 --- a/Service/Charger/Msg/Charger/Req/RecordCharge.cs +++ b/Service/Charger/Msg/Charger/Req/RecordCharge.cs @@ -3,14 +3,14 @@ namespace Service.Charger.Msg.Charger.Req { /// - /// 3.5.5 主动上送充电记录 + /// 3.5.6 主动上送充电记录 /// public class RecordCharge : ASDU { /// /// 订单编号 /// - [Property(0, 256, PropertyReadConstant.Byte)] + [Property(0, 32, PropertyReadConstant.Byte)] public string ChargerOrderNo { get; set; } /// diff --git a/Service/Charger/Msg/Charger/Req/UploadTelemetryData.cs b/Service/Charger/Msg/Charger/Req/UploadTelemetryData.cs index 4f8dd78..c15aaf4 100644 --- a/Service/Charger/Msg/Charger/Req/UploadTelemetryData.cs +++ b/Service/Charger/Msg/Charger/Req/UploadTelemetryData.cs @@ -26,7 +26,7 @@ namespace Service.Charger.Msg.Charger.Req public ushort MaxTempDetectionPointNo { get; set; } /// - /// 最低蓄电池温度 + /// 最低蓄电池温度数据分辨率:1ºC/位,-50 ºC 偏移量;数据范围:-50ºC ~+200ºC; /// [Property(40, 16, PropertyReadConstant.Bit, 1, 0, 50)] public Int16 MinBatteryTemp { get; set; } @@ -110,82 +110,88 @@ namespace Service.Charger.Msg.Charger.Req public Int16 ChargingInterfaceDetectionTwoTemp { get; set; } /// - /// 充电接口温度探头 4 + /// 充电接口温度探头 3 /// [Property(232, 8, PropertyReadConstant.Bit, 1, 0, 50)] + public Int16 ChargingInterfaceDetectionTheTemp { get; set; } + + /// + /// 充电接口温度探头 4 + /// + [Property(232 + 8, 8, PropertyReadConstant.Bit, 1, 0, 50)] public Int16 ChargingInterfaceDetectionFourTemp { get; set; } /// /// 直流电表当前电量 /// - [Property(240, 32, PropertyReadConstant.Bit, 0.01, 2)] + [Property(240 + 8, 32, PropertyReadConstant.Bit, 0.01, 2)] public float DcMeterCurrentPower { get; set; } /// /// 充电电压(直流电表电压) /// - [Property(272, 16, PropertyReadConstant.Bit, 0.1, 1)] + [Property(272 + 8, 16, PropertyReadConstant.Bit, 0.1, 1)] public float DcMeterVoltage { get; set; } /// /// 充电电流(直流电表电流) /// - [Property(288, 16, PropertyReadConstant.Bit, 0.1, 1)] + [Property(288 + 8, 16, PropertyReadConstant.Bit, 0.1, 1)] public float DcMeterCurrent { get; set; } /// /// 高压采集电压 /// - [Property(304, 16, PropertyReadConstant.Bit, 0.1, 1)] + [Property(304 + 8, 16, PropertyReadConstant.Bit, 0.1, 1)] public float HighVoltageAcquisitionVoltage { get; set; } /// /// 高压采集电流 /// - [Property(320, 16, PropertyReadConstant.Bit, 0.1, 1)] + [Property(320 + 8, 16, PropertyReadConstant.Bit, 0.1, 1)] public float HighVoltageAcquisitionCurrent { get; set; } /// /// 桩内部温度 /// - [Property(336, 8, PropertyReadConstant.Bit, 1, 0)] + [Property(336 + 8, 8, PropertyReadConstant.Bit, 1, 0)] public byte ChargerInsideTemp { get; set; } /// /// 本次充电时间 /// - [Property(344, 16)] + [Property(344 + 8, 16)] public ushort ChargingTime { get; set; } /// /// 模块进风口温度 /// - [Property(360, 8)] + [Property(360 + 8, 8)] public byte ModuleOneAirInletTemp { get; set; } /// /// 模块出风口温度 /// - [Property(368, 8)] + [Property(368 + 8, 8)] public byte ModuleTwoAirInletTemp { get; set; } /// /// 充电模式 0:站内充电 1:站外充电 /// - [Property(376, 8)] + [Property(376 + 8, 8)] public byte ChargeModel { get; set; } /// /// 充电启动方式 1:站控启动 2:本地充电 /// - [Property(384, 8)] + [Property(384 + 8, 8)] public byte ChargingStartMethod { get; set; } /// /// 交流电表当前电量 /// - [Property(392, 32, PropertyReadConstant.Bit, 0.01, 2)] + [Property(392 + 8, 32, PropertyReadConstant.Bit, 0.01, 2)] public float ACMeterCurrentBatteryValue { get; set; } } diff --git a/Service/Charger/Msg/Charger/Req/VoltageCurrentSoc.cs b/Service/Charger/Msg/Charger/Req/VoltageCurrentSoc.cs index 305072f..2244024 100644 --- a/Service/Charger/Msg/Charger/Req/VoltageCurrentSoc.cs +++ b/Service/Charger/Msg/Charger/Req/VoltageCurrentSoc.cs @@ -12,31 +12,45 @@ namespace Service.Charger.Msg.Charger.Req /// public class VoltageCurrentSoc : ASDU { + /// + /// 记录类型 + /// + [Property(0, 8)] + public byte RecordType { get; set; } + /// + /// PGN 码 + /// + [Property(8, 8)] + public byte Pgn1 { get; set; } + [Property(16, 8)] + public byte Pgn2 { get; set; } + [Property(24, 8)] + public byte Pgn3 { get; set; } /// /// 电压测量值 分辨率:0.1V/位,偏移量:0V,数值范围:0V ~750V /// - [Property(0, 16, scale: 0.1)] + [Property(32, 16, scale: 0.1)] public float Voltage { get; set; } /// /// 电流测量值 分辨率:0.05A/位,偏移量:-1600A,数值范围:-1600A~1612.75A /// - [Property(16, 16, scale: 0.05, offset: 1600)] + [Property(48, 16, scale: 0.05, offset: 1600)] public float Current { get; set; } /// /// 当前SOC 分辨率:0.1%/位,偏移量:0%,数值范围 0%~100% /// - [Property(32, 16, scale: 0.01)] + [Property(64, 16, scale: 0.1)] public float SOC { get; set; } /// /// 当前SOH 分辨率:1%/位,偏移量:0%,数值范围 0%~100% /// - [Property(48, 8, scale: 0.01)] + [Property(80, 8, scale: 0.01)] public float SOH { get; set; } - /// - /// 保留 - /// - [Property(56, 8)] - public byte Reserve { get; set; } + ///// + ///// 保留 + ///// + //[Property(88, 8)] + //public byte Reserve { get; set; } } } diff --git a/Service/Charger/Msg/Charger/Req/VoltageExtremumStatistics.cs b/Service/Charger/Msg/Charger/Req/VoltageExtremumStatistics.cs new file mode 100644 index 0000000..34e9759 --- /dev/null +++ b/Service/Charger/Msg/Charger/Req/VoltageExtremumStatistics.cs @@ -0,0 +1,60 @@ +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 +{ + /// + /// 3.6.1.4 充放电机上传单体动力蓄电池电压极值统计(PGN:0x00F822) + /// + public class VoltageExtremumStatistics : ASDU + { + /// + /// 记录类型 + /// + [Property(0, 8)] + public byte RecordType { get; set; } + /// + /// PGN 码 + /// + [Property(8, 8)] + public byte Pgn1 { get; set; } + [Property(16, 8)] + public byte Pgn2 { get; set; } + [Property(24, 8)] + public byte Pgn3 { get; set; } + /// + /// 单体蓄电池或蓄电池模块最高电压 + /// 分辨率:0.01V/位,偏移量:0V,数值范围:0V ~24V + /// + [Property(32, 16, scale: 0.01)] + public float MaximumVoltage { get; set; } + /// + /// 最高电压单体蓄电池或蓄电池模块的编号 + /// 分辨率:1/位,偏移量:0,数值范围: + /// + [Property(48, 8)] + public float MaximumVoltageNum { get; set; } + /// + /// 单体蓄电池或蓄电池模块最低电压 + /// 分辨率:0.01V/位,偏移量:0V,数值范围:0V ~24V + /// + [Property(56, 16, scale: 0.01)] + public float MinimumVoltage { get; set; } + /// + /// 最低电压单体蓄电池或蓄电池模块的编号 + /// 分辨率:1/位,偏移量:0,数值范围:1~250 + /// + [Property(72, 8)] + public float MinimumVoltageNum { get; set; } + /// + /// 单体平均电压 + /// 分辨率:0.01V/位,偏移量:0V,数值范围:0V ~24V + /// + [Property(80, 16)] + public float CellAverageVoltage { get; set; } + } +} diff --git a/Service/Charger/Msg/Charger/Resp/QueryBatterySnRes.cs b/Service/Charger/Msg/Charger/Resp/QueryBatterySnRes.cs index 8cca489..19a8b24 100644 --- a/Service/Charger/Msg/Charger/Resp/QueryBatterySnRes.cs +++ b/Service/Charger/Msg/Charger/Resp/QueryBatterySnRes.cs @@ -1,9 +1,9 @@ using HybirdFrameworkCore.Autofac.Attribute; -namespace Service.Charger.Msg.Charger.Resp; +namespace Service.Charger.Msg.Charger.Req; /// -/// 3.6.2.2 充放电机回复电池基本参数 2(PGN:0x00F802) +/// 3.6.2.3 充放电机回复电池基本参数 2(PGN:0x00F802) /// public class QueryBatterySnRes : ASDU { @@ -19,7 +19,7 @@ public class QueryBatterySnRes : ASDU /// /// 电池编码 长度 0 "Do not transmit this Code" /// - [Property(32, 1)] + [Property(32, 8)] public byte BatterSnLength { get; set; } /// @@ -27,7 +27,7 @@ public class QueryBatterySnRes : ASDU /// 1 "CATL" , 2 "Li Shen", 3 "MGL" , /// 4 "SAMSUN", 5 "LG", 6"EVE",7"BYD" /// - [Property(33, 1)] + [Property(40, 8)] public byte BatterFactory { get; set; } /// @@ -41,6 +41,6 @@ public class QueryBatterySnRes : ASDU /// "R"83 "S" 84 "T" 85 "U" 86 "V" 87 /// "W"88 "X" 89 "Y" 90 "Z /// - [Property(34, 27 * 8)] + [Property(start: 48, length: 27, PropertyReadConstant.Byte)] public byte[] BatterSnBytes { get; set; } } \ No newline at end of file diff --git a/Service/Charger/Msg/Charger/Resp/UpAlarm.cs b/Service/Charger/Msg/Charger/Resp/UpAlarm.cs new file mode 100644 index 0000000..5907982 --- /dev/null +++ b/Service/Charger/Msg/Charger/Resp/UpAlarm.cs @@ -0,0 +1,135 @@ +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 +{ + /// + /// 3.6.1.2 充放电机上传报警状态 + /// + public class UpAlarm : ASDU + { + /// + /// 记录类型 + /// + [Property(0, 8)] + public byte RecordType { get; set; } + /// + /// PGN 码 + /// + [Property(8, 8)] + public byte Pgn1 { get; set; } + [Property(16, 8)] + public byte Pgn2 { get; set; } + [Property(24, 8)] + public byte Pgn3 { get; set; } + /// + /// 单体蓄电池或蓄电池模块电压越限 + /// + [Property(32, 16)] + public short SingleBattery { get; set; } + /// + /// 电压偏差越限 + /// + [Property(48, 16)] + public short VoltageOvershoot { get; set; } + /// + /// 温度越限 + /// + [Property(64, 16)] + public short TemperatureExceedance { get; set; } + /// + /// 温度偏差越限 + /// + [Property(80, 16)] + public short TemperatureDifference { get; set; } + /// + /// SOC 低 + /// + [Property(96, 16)] + public short LowSOC { get; set; } + /// + /// 放电电流越限 + /// + [Property(112, 16)] + public short DischargeCurrent { get; set; } + /// + /// 充电电流限 + /// + [Property(128, 16)] + public short ChargingCurrentLimit { get; set; } + /// + /// 总正负极柱温度越限 + /// + [Property(144, 16)] + public short TotalTemp { get; set; } + /// + /// 电池系统故障码 + /// + [Property(160, 16)] + public short BatteryFaultCode { get; set; } + /// + /// 高压绝缘低 + /// + [Property(176, 16)] + public short HighVoltageLow { get; set; } + /// + /// 单体蓄电池或蓄电池模块电压越极限 + /// + [Property(192, 16)] + public short MonomerLimit { get; set; } + /// + /// 电压偏差越极限a + /// + [Property(200, 16)] + public short VoltageDifference { get; set; } + /// + /// 温度越极限 + /// + [Property(216, 16)] + public short TemperatureOvershoot { get; set; } + /// + /// 温度偏差越极限 + /// + [Property(232, 16)] + public short TempDifference { get; set; } + /// + /// SOC 极低 + /// + [Property(248, 16)] + public short VeryLowSOC { get; set; } + /// + /// 放电电流越极限 + /// + [Property(264, 16)] + public short DischargeCurrentLimit { get; set; } + /// + /// 充电电流越极限 + /// + [Property(280, 16)] + public short ChargingCurrent { get; set; } + /// + /// 总正负极柱温度越极限 + /// + [Property(296, 16)] + public short TotalTempLimit { get; set; } + /// + /// 高压绝缘极低 + /// + [Property(312, 16)] + public short highVoltageInsulation { get; set; } + /// + /// 硬件故障 + /// + [Property(328, 16)] + public short HardwareFailure { get; set; } + /// + /// 保留 + /// + [Property(344, 16)] + public short Reserve { get; set; } + } +} diff --git a/Service/Charger/Msg/Charger/Resp/UpgradeRequestRes.cs b/Service/Charger/Msg/Charger/Resp/UpgradeRequestRes.cs index ab5d73d..adbc1f4 100644 --- a/Service/Charger/Msg/Charger/Resp/UpgradeRequestRes.cs +++ b/Service/Charger/Msg/Charger/Resp/UpgradeRequestRes.cs @@ -21,11 +21,13 @@ namespace Service.Charger.Msg.Charger.Resp /// /// 应答结果 /// + [Property(8, 8)] public byte ResponseResult { get; set; } /// /// 失败原因 /// + [Property(16, 8)] public byte CauseFailure { get; set; } } } diff --git a/Service/Charger/Msg/Host/Req/ChangeChargeMode.cs b/Service/Charger/Msg/Host/Req/ChangeChargeMode.cs index 2b539a7..0a778b2 100644 --- a/Service/Charger/Msg/Host/Req/ChangeChargeMode.cs +++ b/Service/Charger/Msg/Host/Req/ChangeChargeMode.cs @@ -17,7 +17,7 @@ namespace Service.Charger.Msg.Host.Req /// 00:无效 01:站内 02:站外 /// [Property(8, 16)] - public byte ChargeMode { get; set; } + public short ChargeMode { get; set; } public ChangeChargeMode(byte chargeMode) { diff --git a/Service/Charger/Msg/Host/Req/InquireGatewaySpikesValleys.cs b/Service/Charger/Msg/Host/Req/InquireGatewaySpikesValleys.cs index 65cb991..cb7cef7 100644 --- a/Service/Charger/Msg/Host/Req/InquireGatewaySpikesValleys.cs +++ b/Service/Charger/Msg/Host/Req/InquireGatewaySpikesValleys.cs @@ -2,9 +2,6 @@ namespace Service.Charger.Msg.Host.Req { - /// - /// 3.5.7 站控查询监控网关尖峰平谷设置 - /// public class InquireGatewaySpikesValleys : ASDU { /// diff --git a/WebStarter/appsettings.json b/WebStarter/appsettings.json index f8ca381..c8ae7a4 100644 --- a/WebStarter/appsettings.json +++ b/WebStarter/appsettings.json @@ -2,7 +2,7 @@ "ConnectionStrings": { "ConfigId": "master", "DbType": "MySql", - "SqlConnection": "server=127.0.0.1;Port=3306;Database=huanneng_dev;Uid=root;Pwd=anyixing2023!@#;Charset=utf8" + "SqlConnection": "server=127.0.0.1;Port=3306;Database=huanneng_dev;Uid=root;Pwd=anyixing2023!@#;Charset=utf8;" }, "Update": { "AutoUpdate": "false", diff --git a/WinFormStarter/Form2.cs b/WinFormStarter/Form2.cs index 7080c08..6a15c0c 100644 --- a/WinFormStarter/Form2.cs +++ b/WinFormStarter/Form2.cs @@ -23,7 +23,7 @@ public partial class Form2 : Form { this.txtIp.Text = @"172.0.30.13"; this.txtPort.Text = @"2408"; - this.txtDestAddr.Text = @"03,01,01,02"; + this.txtDestAddr.Text = @"04,00,00,16"; this.grpCmd.Enabled = false; this.grpData.Enabled = false;