5.25周六现场调试更改

zw
CZ 6 months ago
parent 7fac377cd7
commit 115c9246f7

@ -242,17 +242,24 @@ public static class BitUtls
public static ushort Byte2UInt16(byte[] bytes, int startBit, int length)
{
if (length < 9 || length > 16) throw new ArgumentException("length should be less then 17 and greater then 8");
var sub = Sub(bytes, startBit, length);
if (sub.Length == 1)
{
return Convert.ToUInt16(sub[0]);
}
return BitConverter.ToUInt16(sub, 0);
}
public static short Byte2Int16(byte[] bytes, int startBit, int length)
{
if (length < 9 || length > 16) throw new ArgumentException("length should be less then 17 and greater then 8");
var sub = Sub(bytes, startBit, length);
if (sub.Length == 1)
{
return Convert.ToInt16(sub[0]);
}
return BitConverter.ToInt16(sub, 0);
}

@ -149,7 +149,7 @@ public static class ClientMgr
ChargerClient client = AppInfo.Container.Resolve<ChargerClient>();
client.InitBootstrap(netInfo.NetAddr, int.Parse(netInfo.NetPort));
client.Connect();
client.SessionAttr(netInfo.Code, netInfo.NetAddr);
client.SessionAttr(netInfo.Code, netInfo.DestAddr);
AddBySn(netInfo.Code, client);
Log.Info($"connected {netInfo.Code} {netInfo.NetAddr}:{netInfo.NetPort}");
}

@ -11,6 +11,7 @@ using Service.Charger.Msg.Bms;
using Service.Charger.Msg.Charger.Req;
using Service.Charger.Msg.Charger.Resp;
using Service.Charger.Msg.Host.Req;
using static System.Net.Mime.MediaTypeNames;
namespace Service.Charger.Codec;
@ -140,6 +141,7 @@ public class Decoder : ByteToMessageDecoder
50 => ModelConvert.Decode<SdUpPkFtValSet>(bytes),
52 => ModelConvert.Decode<AuthVINRes>(bytes),
75 => ModelConvert.Decode<UploadModuleStatus>(bytes),
80 => new Test(),
81 => ModelConvert.Decode<RemoteSignaling>(bytes),
82 => ModelConvert.Decode<BatteryPackData>(bytes),
83 => ModelConvert.Decode<BatteryPackDataVoltage>(bytes),
@ -212,6 +214,7 @@ public class Decoder : ByteToMessageDecoder
57 => ModelConvert.Decode<CscSumVolt>(bytes),
58 => ModelConvert.Decode<CscSumTemp>(bytes),
59 => ModelConvert.Decode<TimingInfo>(bytes),
62 => new Test(),
81 => ModelConvert.Decode<QueryBatterySnRes>(bytes),
142 => ModelConvert.Decode<BattenergyInfo1>(bytes),
143 => ModelConvert.Decode<BattenergyInfo2>(bytes),

@ -22,7 +22,8 @@ namespace Service.Charger.Handler
protected override void ChannelRead0(IChannelHandlerContext ctx, StopCharging msg)
{
if (ClientMgr.TryGetClient(ctx.Channel, out var sn, out var client))
{Log.Info($"receive {msg} from {sn}");
{
Log.Info($"receive {msg} from {sn}");
client.IsCanSendStopCmd = false;
ChargingStopFsdRes stopFsdRes = new ChargingStopFsdRes(0);
ctx.Channel.WriteAndFlushAsync(stopFsdRes);

@ -35,10 +35,6 @@ namespace Service.Charger.Handler
client.TotalWarning = msg.TotalWarning;
client.UploadRemoteSignalData = msg;
}
else
{
client.ChargingStatus = (int)ChargingStatus.StartChargingFailed;
}
}
}
}

@ -32,10 +32,6 @@ namespace Service.Charger.Handler
//充电机实时充电功率
client.RealTimeChargePower = msg.HighVoltageAcquisitionCurrent * msg.HighVoltageAcquisitionVoltage;
}
else
{
client.ChargingStatus = (int)ChargingStatus.StartChargingFailed;
}
}
}
}

@ -16,14 +16,14 @@ namespace Service.Charger.Msg.Charger.Req
/// <summary>
/// 最高蓄电池温度
/// </summary>
[Property(8, 2, PropertyReadConstant.Byte, 1, 0, 50)]
[Property(8, 16, offset: 50)]
public Int16 MaxBatteryTemp { get; set; }
/// <summary>
/// 最高温度检测点编号
/// </summary>
[Property(24, 16)]
public byte MaxTempDetectionPointNo { get; set; }
public ushort MaxTempDetectionPointNo { get; set; }
/// <summary>
/// 最低蓄电池温度
@ -35,7 +35,7 @@ namespace Service.Charger.Msg.Charger.Req
/// 最低温度检测点编号
/// </summary>
[Property(56, 16)]
public byte MinTempDetectionPointNo { get; set; }
public ushort MinTempDetectionPointNo { get; set; }
/// <summary>
/// 单体电池最高电压

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Msg
{
public class Test : ASDU
{
}
}

@ -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