添加漏的2数据帧

zw
CZ 6 months ago
parent 115c9246f7
commit 3c0a52b2f9

@ -8,7 +8,15 @@ public class PropertyAttribute : System.Attribute
public readonly double Scale;
public readonly int Start;
public readonly PropertyReadConstant Type;
/// <summary>
///
/// </summary>
/// <param name="start"></param>
/// <param name="length"></param>
/// <param name="type"></param>
/// <param name="scale">缩放</param>
/// <param name="round">舍入方式,用于处理浮点数的精度问题</param>
/// <param name="offset">偏移量</param>
public PropertyAttribute(int start, int length, PropertyReadConstant type = PropertyReadConstant.Bit,
double scale = 1, int round = 0, double offset = 0)
{

@ -141,7 +141,7 @@ public class Decoder : ByteToMessageDecoder
50 => ModelConvert.Decode<SdUpPkFtValSet>(bytes),
52 => ModelConvert.Decode<AuthVINRes>(bytes),
75 => ModelConvert.Decode<UploadModuleStatus>(bytes),
80 => new Test(),
80 => ModelConvert.Decode<ModuleState>(bytes),
81 => ModelConvert.Decode<RemoteSignaling>(bytes),
82 => ModelConvert.Decode<BatteryPackData>(bytes),
83 => ModelConvert.Decode<BatteryPackDataVoltage>(bytes),
@ -214,7 +214,7 @@ public class Decoder : ByteToMessageDecoder
57 => ModelConvert.Decode<CscSumVolt>(bytes),
58 => ModelConvert.Decode<CscSumTemp>(bytes),
59 => ModelConvert.Decode<TimingInfo>(bytes),
62 => new Test(),
62 => ModelConvert.Decode<VoltageCurrentSoc>(bytes),
81 => ModelConvert.Decode<QueryBatterySnRes>(bytes),
142 => ModelConvert.Decode<BattenergyInfo1>(bytes),
143 => ModelConvert.Decode<BattenergyInfo2>(bytes),

@ -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.Host.Resp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Handler
{
/// <summary>
/// 3.5.18 充放电机上报模块状态消息名称 充放电机上
/// </summary>
[Order(8)]
[Scope("InstancePerDependency")]
public class ModuleStateHandler : SimpleChannelInboundHandler<ModuleState>, IBaseHandler
{
private readonly ILog Log = LogManager.GetLogger(typeof(ModuleStateHandler));
protected override void ChannelRead0(IChannelHandlerContext ctx, ModuleState msg)
{
if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
{
Log.Info($"receive {msg} from {sn}");
}
}
}
}

@ -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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Handler
{
/// <summary>
/// 3.6.1.3 充放电机上传电压电流 SOC 数据PGN:0x00F812
/// </summary>
[Order(8)]
[Scope("InstancePerDependency")]
public class VoltageCurrentSocHandler : SimpleChannelInboundHandler<VoltageCurrentSoc>, IBaseHandler
{
private readonly ILog Log = LogManager.GetLogger(typeof(VoltageCurrentSocHandler));
protected override void ChannelRead0(IChannelHandlerContext ctx, VoltageCurrentSoc msg)
{
if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
{
Log.Info($"receive {msg} from {sn}");
}
}
}
}

@ -1,57 +0,0 @@
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;
namespace Service.Charger.Msg.Charger.Req
{
/// <summary>
/// 3.5.18 充放电机上报模块状态
/// </summary>
public class ModuleState : ASDU
{
/// <summary>
/// 模块总数量
/// </summary>
[Property(0, 8)]
public byte ModelCount { get; set; }
/// <summary>
/// 模块状态
/// </summary>
[Property(8, 8)]
public byte ModelState1 { get; set; }
/// <summary>
/// 模块状态
/// </summary>
[Property(16, 8)]
public byte ModelState2 { get; set; }
/// <summary>
/// 模块状态
/// </summary>
[Property(24, 8)]
public byte ModelState3 { get; set; }
/// <summary>
/// 模块状态
/// </summary>
[Property(32, 8)]
public byte ModelState4 { get; set; }
/// <summary>
/// 模块状态
/// </summary>
[Property(40, 8)]
public byte ModelState5 { get; set; }
/// <summary>
/// 模块状态
/// </summary>
[Property(48, 8)]
public byte ModelState6 { get; set; }
/// <summary>
/// 模块状态
/// </summary>
[Property(56, 8)]
public byte ModelState7 { get; set; }
}
}

@ -1,252 +0,0 @@
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; }
}
}

@ -21,6 +21,6 @@ namespace Service.Charger.Msg.Charger.Req
/// VIN
/// </summary>
[Property(8, 17, type: PropertyReadConstant.Byte)]
public string vin { get; set; }
public string Vin { get; set; }
}
}

@ -1,26 +0,0 @@
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,42 @@
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.6.1.3 充放电机上传电压电流 SOC 数据PGN:0x00F812
/// </summary>
public class VoltageCurrentSoc : ASDU
{
/// <summary>
/// 电压测量值 分辨率0.1V/位偏移量0V数值范围0V ~750V
/// </summary>
[Property(0, 16, scale: 0.1)]
public float Voltage { get; set; }
/// <summary>
/// 电流测量值 分辨率0.05A/位,偏移量:-1600A数值范围-1600A~1612.75A
/// </summary>
[Property(16, 16, scale: 0.05, offset: 1600)]
public float Current { get; set; }
/// <summary>
/// 当前SOC 分辨率0.1%/位偏移量0%,数值范围 0%~100%
/// </summary>
[Property(32, 16, scale: 0.01)]
public float SOC { get; set; }
/// <summary>
/// 当前SOH 分辨率1%/位偏移量0%,数值范围 0%~100%
/// </summary>
[Property(48, 8, scale: 0.01)]
public float SOH { get; set; }
/// <summary>
/// 保留
/// </summary>
[Property(56, 8)]
public byte Reserve { get; set; }
}
}

@ -1,35 +0,0 @@
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; }
}
}

@ -2,7 +2,7 @@
"ConnectionStrings": {
"ConfigId": "master",
"DbType": "MySql",
"SqlConnection": "server=180.76.133.253;Port=16306;Database=huanneng_dev;Uid=root;Pwd=Rszn123;Charset=utf8"
"SqlConnection": "server=127.0.0.1;Port=3306;Database=huanneng_dev;Uid=root;Pwd=anyixing2023!@#;Charset=utf8"
},
"Update": {
"AutoUpdate": "false",

Loading…
Cancel
Save