电池信息上传

master
rszn 5 months ago
parent 397f38845e
commit 7b47ffad98

@ -76,6 +76,7 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
///
/// </summary>
public MsgPair<VehicleCertification, VehicleCertificationResp> CarAuth { get; set; } = new();
public MsgPair<BatDataInfo, BatDataInfoRes> BatData { get; set; } = new();
public MsgPair<ChannelStatusReporting, ChannelStatusReportingResp> ChannelStatus { get; set; } = new();
public MsgPair<AirConditioningData, AirConditioningDataResp> AirConditioning { get; set; } = new();
public MsgPair<ChargeRecordReporting, ChargeRecordReportingResp> ChargeRecord { get; set; } = new();
@ -404,6 +405,14 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
return CarAuth.GetResp(timeSpan);
}
public BatDataInfoRes? SendBatDataInfo(BatDataInfo batDataInfo,
TimeSpan? timeSpan = null)
{
this.BatData.Req = batDataInfo;
this.Publish(batDataInfo);
return BatData.GetResp(timeSpan);
}
/// <summary>
/// 换电站通道状态上报
/// </summary>

@ -19,6 +19,7 @@ public class CloudClientMgr
public static CloudClient? CloudClient { get; set; }
private static DateTime _dateTime = DateTime.Now.AddSeconds(-30);
public static void Init()
{
CloudClient = AppInfo.Container.Resolve<CloudClient>();
@ -53,45 +54,65 @@ public class CloudClientMgr
{
BinInfo? binInfo = binInfoRepository.QueryByClause(it => it.ChargerNo == data.ChargerNo);
ChargeDevDataInfo req = new ChargeDevDataInfo();
req.sn = StaticStationInfo.StationNo;
req.en = StaticStationInfo.StationNo + data.ChargerNo;
req.sd = "A"+int.Parse(binInfo.No);
req.mtp = StaticStationInfo.ChargePower;
req.mcr = 1;
req.hb = binInfo?.Exists??0;
req.el = 0;
req.cno = int.Parse(binInfo.No);
req.cs = binInfo.ChargeStatus??0;
req.fs = 0;
req.@as = 0;
//fc = data.,
//st = data.,
req.ct = data.ChargingTime;
//ssoc = data.,
req.csoc = data.CurrentSoc;
//ssoe = data.,
//csoe = data.,
req.cvot = data.BmsChargingVoltage;
req.ccur = data.BmsChargingCurrent;
req.nvot = data.BmsNeedVoltage;
req.ncur = data.BmsNeedCurrent;
req.lsv = data.SingleBatteryMinVoltage;
req.hsv = data.SingleBatteryMaxVoltage;
req.lst = data.MinBatteryTemp;
req.hst = data.MaxBatteryTemp;
req.ws = 0xFF;
req.it = 0xFF;
req.ot = 0xFF;
req.bt = DateTime.Now;
req.sn = StaticStationInfo.StationNo;
req.en = StaticStationInfo.StationNo + data.ChargerNo;
req.sd = "A" + int.Parse(binInfo.No);
req.mtp = StaticStationInfo.ChargePower;
req.mcr = 1;
req.hb = binInfo?.Exists ?? 0;
req.el = 0;
req.cno = int.Parse(binInfo.No);
req.cs = binInfo.ChargeStatus ?? 0;
req.fs = 0;
req.@as = 0;
//fc = data.,
//st = data.,
req.ct = data.ChargingTime;
//ssoc = data.,
req.csoc = data.CurrentSoc;
//ssoe = data.,
//csoe = data.,
req.cvot = data.BmsChargingVoltage;
req.ccur = data.BmsChargingCurrent;
req.nvot = data.BmsNeedVoltage;
req.ncur = data.BmsNeedCurrent;
req.lsv = data.SingleBatteryMinVoltage;
req.hsv = data.SingleBatteryMaxVoltage;
req.lst = data.MinBatteryTemp;
req.hst = data.MaxBatteryTemp;
req.ws = 0xFF;
req.it = 0xFF;
req.ot = 0xFF;
req.bt = DateTime.Now;
if ((DateTime.Now - _dateTime).TotalSeconds <= 30)
{
return;
}
_dateTime = DateTime.Now;
CloudClient?.SendChargeDevDataInfo(req);
CloudClient?.SendChargeDevDataInfo(req);
}
}
}
catch (Exception e)
{
Log.Info("error", e);
}
});
redisHelper?.GetSubscriber().Subscribe("BatteryInfoUploadTask", (channel, value) =>
{
try
{
Log.Info($"receive BatteryInfoUploadTask={value}");
if (value.HasValue)
{
BatDataInfo? data = JsonConvert.DeserializeObject<BatDataInfo>(value.ToString());
if (data != null)
{
CloudClient?.SendBatDataInfo(data);
}
}
}

@ -59,24 +59,25 @@ public class CloudConst
public static readonly string eqmStateEndLogInfoRes = "eqmStateEndLogInfoRes";
public static readonly string chargeDevDataInfo = "chargeDevDataInfo";
public static readonly string chargeDevDataInfoRes = "chargeDevDataInfoRes";
public static readonly string batDataInfo = "batDataInfo";
/// <summary>
/// 站外
/// </summary>
public static readonly string pileStartCharge = "pileStartCharge";
public static readonly string pileStartChargeRes = "pileStartChargeRes";
public static readonly string pileStopCharge = "pileStopCharge";
public static readonly string pileRealtimeRes = "pileRealtimeRes";
public static readonly string pileEndCharge = "pileEndCharge";
public static readonly string pileEndChargeRes = "pileEndChargeRes";
public static readonly string pileChargeRealtime = "pileChargeRealtime";
public static readonly string pileChargeRealtimeRes = "pileChargeRealtimeRes";
public static readonly string pileRealtime = "pileRealtime";
#endregion
}
}

@ -1,81 +0,0 @@
namespace Service.Cloud.Msg.Cloud.Resp;
/// <summary>
/// 4.2.11.1 换电站电池包数据信息
/// </summary>
public class BatDataInfo
{
/// <summary>
/// 场站编码 换电站唯一码
/// </summary>
public string sn { get; set; }
/// <summary>
/// 换电站电池包总 数量
/// </summary>
public int batn { get; set; }
/// <summary>
/// 电池序列号
/// </summary>
public string bn { get; set; }
/// <summary>
/// 充电架 ID 按电池架的编号 A1A2…
/// </summary>
public string sd { get; set; }
/// <summary>
/// 所在充电机序号 从 1 开始递增
/// </summary>
public int cno { get; set; }
/// <summary>
/// 是否在充电 0未知 1正在充电 2未电池
/// </summary>
public int hc { get; set; }
/// <summary>
/// 电接头连接状态 0未知 1已经连接 2未连接
/// </summary>
public int el { get; set; }
/// <summary>
/// 剩余能量 单位 0.1 kwh
/// </summary>
public float soe { get; set; }
/// <summary>
/// 当前 SOC 0-100 单位 0.1 ,没有充电填 0
/// </summary>
public float soc { get; set; }
/// <summary>
/// 当前 SOH 0-100 单位 0.1 ,没有充电填 0
/// </summary>
public float soh { get; set; }
/// <summary>
/// 最低单体电压 单位 0.01V
/// </summary>
public float lsv { get; set; }
/// <summary>
/// 最高单体电压 单位 0.01V
/// </summary>
public float hsv { get; set; }
/// <summary>
/// 最低单体温度 单位 0.1℃
/// </summary>
public float lst { get; set; }
/// <summary>
/// 最高单体温度 单位 0.1℃
/// </summary>
public float hst { get; set; }
/// <summary>
/// 单体电池号 从 1 开始递增
/// </summary>
public int sl { get; set; }
/// <summary>
/// 单体电压 每一节电芯的单体电压 单位 0.1V 如果没有该节电芯的数据填65535.0 无效值
/// </summary>
public float sv { get; set; }
/// <summary>
/// 单体温度 每一节电芯的单体温度 单位 0.1℃ ,如果没有该节电芯的数据填65535.0 无效值
/// </summary>
public float st { get; set; }
/// <summary>
/// 更新时间 格式 ”yyyy-MM-dd HH:mm:ss ”
/// </summary>
public DateTime bt { get; set; }
}

@ -1,16 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Service.Cloud.Common;
namespace Service.Cloud.Msg.Host.Req
{
/// <summary>
/// 4.2.11.1 换电站电池包数据信息
/// </summary>
public class BatDataInfo
public class BatDataInfo : ICmd
{
/// <summary>
/// 场站编码 换电站唯一码
/// </summary>
public string sn { get; set; }
/// <summary>
/// 换电站电池包总 数量
/// </summary>
public int batn { get; set; }
/// <summary>
/// 电池信息
/// </summary>
public List<SingleBatInfo> datainfo { get; set; }
public string GetCmd()
{
return CloudConst.batDataInfo;
}
}
}

@ -0,0 +1,84 @@
namespace Service.Cloud.Msg.Host.Req;
public class SingleBatInfo
{
/// <summary>
/// 电池序列号
/// </summary>
public string bn { get; set; }
/// <summary>
/// 充电架 ID 按电池架的编号 A1A2…
/// </summary>
public string sd { get; set; }
/// <summary>
/// 所在充电机序号 从 1 开始递增
/// </summary>
public int cno { get; set; }
/// <summary>
/// 是否在充电 0未知 1正在充电 2未电池
/// </summary>
public int hc { get; set; }
/// <summary>
/// 电接头连接状态 0未知 1已经连接 2未连接
/// </summary>
public int el { get; set; }
/// <summary>
/// 剩余能量 单位 0.1 kwh
/// </summary>
public float soe { get; set; }
/// <summary>
/// 当前 SOC 0-100 单位 0.1 ,没有充电填 0
/// </summary>
public float soc { get; set; }
/// <summary>
/// 当前 SOH 0-100 单位 0.1 ,没有充电填 0
/// </summary>
public float soh { get; set; }
/// <summary>
/// 最低单体电压 单位 0.01V
/// </summary>
public float lsv { get; set; }
/// <summary>
/// 最高单体电压 单位 0.01V
/// </summary>
public float hsv { get; set; }
/// <summary>
/// 最低单体温度 单位 0.1℃
/// </summary>
public float lst { get; set; }
/// <summary>
/// 最高单体温度 单位 0.1℃
/// </summary>
public float hst { get; set; }
/// <summary>
/// 单体电池号 从 1 开始递增
/// </summary>
public int sl { get; set; }
/// <summary>
/// 单体电压 每一节电芯的单体电压 单位 0.1V 如果没有该节电芯的数据填65535.0 无效值
/// </summary>
public float sv { get; set; }
/// <summary>
/// 单体温度 每一节电芯的单体温度 单位 0.1℃ ,如果没有该节电芯的数据填65535.0 无效值
/// </summary>
public float st { get; set; }
/// <summary>
/// 更新时间 格式 ”yyyy-MM-dd HH:mm:ss ”
/// </summary>
public DateTime bt { get; set; }
}

@ -23,12 +23,18 @@
"AllowedHosts": "*",
"": null,
"Cryptogram": {
"StrongPassword": "false", //
"PasswordStrengthValidation": "(?=^.{6,16}$)(?=.*\\d)(?=.*\\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\\n).*$", // 6-16
"PasswordStrengthValidationMsg": "密码必须包含大小写字母、数字和特殊字符的组合长度在6-16之间", //
"CryptoType": "SM2", // MD5SM2SM4
"PublicKey": "0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312", //
"PrivateKey": "8EDB615B1D48B8BE188FC0F18EC08A41DF50EA731FA28BF409E6552809E3A111" //
"StrongPassword": "false",
//
"PasswordStrengthValidation": "(?=^.{6,16}$)(?=.*\\d)(?=.*\\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\\n).*$",
// 6-16
"PasswordStrengthValidationMsg": "密码必须包含大小写字母、数字和特殊字符的组合长度在6-16之间",
//
"CryptoType": "SM2",
// MD5SM2SM4
"PublicKey": "0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312",
//
"PrivateKey": "8EDB615B1D48B8BE188FC0F18EC08A41DF50EA731FA28BF409E6552809E3A111"
//
},
//Login
"TokenOptions": {
@ -38,34 +44,62 @@
"Issuer": "jwtIssuer"
},
"Upload": {
"Path": "Upload/{yyyy}/{MM}/{dd}", //
"MaxSize": 20480, // KB1024*20
"ContentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif", "image/bmp", "text/plain", "application/pdf", "application/msword", "application/vnd.ms-excel", "application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "video/mp4" ],
"EnableMd5": false // MDF5-
"Path": "Upload/{yyyy}/{MM}/{dd}",
//
"MaxSize": 20480,
// KB1024*20
"ContentType": [
"image/jpg",
"image/png",
"image/jpeg",
"image/gif",
"image/bmp",
"text/plain",
"application/pdf",
"application/msword",
"application/vnd.ms-excel",
"application/vnd.ms-powerpoint",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"video/mp4"
],
"EnableMd5": false
// MDF5-
},
//SysLogin
"JWTSettings": {
"ValidateIssuerSigningKey": true, // bool true
"IssuerSigningKey": "3c1cbc3f546eda35168c3aa3cb91780fbe703f0996c6d123ea96dc85c70bbc0a", // string 16
"ValidateIssuer": true, // bool true
"ValidIssuer": "Admin.NET", // string
"ValidateAudience": true, // bool true
"ValidAudience": "Admin.NET", // string
"ValidateLifetime": true, // bool truetrue
"ValidateIssuerSigningKey": true,
// bool true
"IssuerSigningKey": "3c1cbc3f546eda35168c3aa3cb91780fbe703f0996c6d123ea96dc85c70bbc0a",
// string 16
"ValidateIssuer": true,
// bool true
"ValidIssuer": "Admin.NET",
// string
"ValidateAudience": true,
// bool true
"ValidAudience": "Admin.NET",
// string
"ValidateLifetime": true,
// bool truetrue
//"ExpiredTime": 20, // long 20 13
"ClockSkew": 5, // long 5
"Algorithm": "HS256", // string HS256
"RequireExpirationTime": true // false
"ClockSkew": 5,
// long 5
"Algorithm": "HS256",
// string HS256
"RequireExpirationTime": true
// false
},
"SnowId": {
"WorkerId": 1, //
"WorkerIdBitLength": 6, // 6 [1, 19]
"SeqBitLength": 6, // 6 [3, 21]4Id
"WorkerPrefix": "adminnet_" //
"WorkerId": 1,
//
"WorkerIdBitLength": 6,
// 6 [1, 19]
"SeqBitLength": 6,
// 6 [3, 21]4Id
"WorkerPrefix": "adminnet_"
//
},
"HttpContextRequest": {
"Scheme": ""
},
@ -88,7 +122,7 @@
"task": {
"enable": false
},
"Log": {
"Log": {
"Src": "D:\\RiderProjects\\hn_back_charger\\WebStarter\\bin\\Debug\\net6.0\\logs",
"Dest": "D:\\zip",
"Days": 7

@ -122,7 +122,10 @@
"task": {
"enable": true
},
"Log": {
"Task": {
"Disabled": "ChargeOrderUploadTask"
},
"Log": {
"Src": "D:\\RiderProjects\\hn_back_charger\\WebStarter\\bin\\Debug\\net6.0\\logs",
"Dest": "D:\\zip",
"Days": 7

Loading…
Cancel
Save