充电机遥测数据上报

master
smartwyy 6 months ago
parent 870de04782
commit e903270fa1

@ -209,6 +209,7 @@ public class StationParamConst
//充电soc //充电soc
public static readonly string ChargeSoc = "Station.ChargeSoc"; public static readonly string ChargeSoc = "Station.ChargeSoc";
public static readonly string ChargePower = "Station.ChargePower";
public static readonly string AutoChargeEnabled = "Station.AutoChargeEnabled"; public static readonly string AutoChargeEnabled = "Station.AutoChargeEnabled";
public static readonly string Eid = "Station.Eid"; public static readonly string Eid = "Station.Eid";
public static readonly string Oid = "Station.Oid"; public static readonly string Oid = "Station.Oid";

@ -1,14 +1,21 @@
using Autofac; using Autofac;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac; using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Autofac.Attribute; using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Redis;
using log4net;
using Newtonsoft.Json;
using Repository.Station;
using Service.Cloud.Msg;
using Service.Cloud.Msg.Host.Req;
using Service.Init; using Service.Init;
using Service.System;
namespace Service.Cloud.Client; namespace Service.Cloud.Client;
[Scope("SingleInstance")] [Scope("SingleInstance")]
public class CloudClientMgr public class CloudClientMgr
{ {
private static readonly ILog Log = LogManager.GetLogger(typeof(CloudClientMgr));
public static CloudClient? CloudClient { get; set; } public static CloudClient? CloudClient { get; set; }
public static void Init() public static void Init()
@ -29,5 +36,54 @@ public class CloudClientMgr
CloudClient.InitHandler(); CloudClient.InitHandler();
Task.Run(() => CloudClient.Connect()); Task.Run(() => CloudClient.Connect());
RedisHelper? redisHelper = AppInfo.Container.Resolve<RedisHelper>();
BinInfoRepository binInfoRepository = AppInfo.Container.Resolve<BinInfoRepository>();
redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) =>
{
Log.Info($"receive UploadTelemetryData={value}");
if (value.HasValue)
{
UploadTelemetryData? data = JsonConvert.DeserializeObject<UploadTelemetryData>(value.ToString());
if (data != null)
{
BinInfo? binInfo = binInfoRepository.QueryByClause(it => it.ChargerNo == data.ChargerNo);
ChargeDevDataInfo req = new ChargeDevDataInfo()
{
sn = StaticStationInfo.StationNo,
en = data.ChargerNo,
sd = "A"+int.Parse(data.ChargerNo),
mtp = StaticStationInfo.ChargePower,
mcr = 1,
hb = binInfo?.Exists??0,
el = 0,
cno = int.Parse(data.ChargerNo),
cs = binInfo.ChargeStatus??0,
fs = 0,
@as = 0,
//fc = data.,
//st = data.,
ct = data.ChargingTime,
//ssoc = data.,
csoc = data.CurrentSoc,
//ssoe = data.,
//csoe = data.,
cvot = data.BmsChargingVoltage,
ccur = data.BmsChargingCurrent,
nvot = data.BmsNeedVoltage,
ncur = data.BmsNeedCurrent,
lsv = data.SingleBatteryMinVoltage,
hsv = data.SingleBatteryMaxVoltage,
lst = data.MinBatteryTemp,
hst = data.MaxBatteryTemp,
ws = 0xFF,
it = 0xFF,
ot = 0xFF,
bt = DateTime.Now
};
CloudClient?.SendChargeDevDataInfo(req);
}
}
});
} }
} }

@ -0,0 +1,169 @@
namespace Service.Cloud.Msg
{
/// <summary>
/// 3.5.4 遥测数据上报
/// </summary>
public class UploadTelemetryData
{
/// <summary>
/// 当前 SOC
/// </summary>
public byte CurrentSoc { get; set; }
/// <summary>
/// 最高蓄电池温度
/// </summary>
public Int16 MaxBatteryTemp { get; set; }
/// <summary>
/// 最高温度检测点编号
/// </summary>
public ushort MaxTempDetectionPointNo { get; set; }
/// <summary>
/// 最低蓄电池温度数据分辨率1ºC/位,-50 ºC 偏移量;数据范围:-50ºC ~+200ºC
/// </summary>
public Int16 MinBatteryTemp { get; set; }
/// <summary>
/// 最低温度检测点编号
/// </summary>
public ushort MinTempDetectionPointNo { get; set; }
/// <summary>
/// 单体电池最高电压
/// </summary>
public float SingleBatteryMaxVoltage { get; set; }
/// <summary>
/// 单体电池最低压
/// </summary>
public float SingleBatteryMinVoltage { get; set; }
/// <summary>
/// 充电机环境温度
/// </summary>
public Int16 ChargerEnvTemp { get; set; }
/// <summary>
/// 充电导引电压
/// </summary>
public float ChargingPilotVoltage { get; set; }
/// <summary>
/// BMS 需求电压
/// </summary>
public float BmsNeedVoltage { get; set; }
/// <summary>
/// BMS 需求电流
/// </summary>
public float BmsNeedCurrent { get; set; }
/// <summary>
/// 充电模式 01H:恒压充电、02H恒流充电
/// </summary>
public byte ChargeMode { get; set; }
/// <summary>
/// BMS 充电电压测量值
/// </summary>
public float BmsChargingVoltage { get; set; }
/// <summary>
/// BMS 充电电流测量值
/// </summary>
public float BmsChargingCurrent { get; set; }
/// <summary>
/// 估算剩余充电时间
/// </summary>
public ushort EstimatedRemainingTime { get; set; }
/// <summary>
/// 充电接口温度探头 1
/// </summary>
public Int16 ChargingInterfaceDetectionOneTemp { get; set; }
/// <summary>
/// 充电接口温度探头 2
/// </summary>
public Int16 ChargingInterfaceDetectionTwoTemp { get; set; }
/// <summary>
/// 充电接口温度探头 3
/// </summary>
public Int16 ChargingInterfaceDetectionTheTemp { get; set; }
/// <summary>
/// 充电接口温度探头 4
/// </summary>
public Int16 ChargingInterfaceDetectionFourTemp { get; set; }
/// <summary>
/// 直流电表当前电量
/// </summary>
public float DcMeterCurrentPower { get; set; }
/// <summary>
/// 充电电压(直流电表电压)
/// </summary>
public float DcMeterVoltage { get; set; }
/// <summary>
/// 充电电流(直流电表电流)
/// </summary>
public float DcMeterCurrent { get; set; }
/// <summary>
/// 高压采集电压
/// </summary>
public float HighVoltageAcquisitionVoltage { get; set; }
/// <summary>
/// 高压采集电流
/// </summary>
public float HighVoltageAcquisitionCurrent { get; set; }
/// <summary>
/// 桩内部温度
/// </summary>
public byte ChargerInsideTemp { get; set; }
/// <summary>
/// 本次充电时间
/// </summary>
public ushort ChargingTime { get; set; }
/// <summary>
/// 模块进风口温度
/// </summary>
public byte ModuleOneAirInletTemp { get; set; }
/// <summary>
/// 模块出风口温度
/// </summary>
public byte ModuleTwoAirInletTemp { get; set; }
/// <summary>
/// 充电模式 0站内充电 1站外充电
/// </summary>
public byte ChargeModel { get; set; }
/// <summary>
/// 充电启动方式 1站控启动 2本地充电
/// </summary>
public byte ChargingStartMethod { get; set; }
/// <summary>
/// 交流电表当前电量
/// </summary>
public float ACMeterCurrentBatteryValue { get; set; }
/// <summary>
/// 设备编号
/// </summary>
public string ChargerNo { get; set; }
}
}

@ -96,6 +96,12 @@ public class StaticStationInfo
set => Set(StationParamConst.ChargeSoc, value); set => Set(StationParamConst.ChargeSoc, value);
} }
public static float ChargePower
{
get => float.Parse(Resolve(StationParamConst.ChargePower));
set => Set(StationParamConst.ChargeSoc, value);
}
/// <summary> /// <summary>
/// 0-关闭 1-开启 /// 0-关闭 1-开启
/// </summary> /// </summary>

Loading…
Cancel
Save