现场代码提交

master
CZ 3 months ago
parent b262265a51
commit bade95f3d1

@ -0,0 +1,63 @@
namespace Entity.Dto.Resp;
public class WaterCoolStatusResp
{
public string Sn { get; set; }
/// <summary>
/// TMS 工作状态
/// 0关机模式1制冷模式2制热模式3自循环模式
/// </summary>
public byte TmsStatus { get; set; }
/// <summary>
/// TMS 高压继电器状态
/// 0 断开状态1 闭合状态2~3 无效
/// </summary>
public byte TmsHighStatus { get; set; }
/// <summary>
/// 出水温度(机组到电池)
/// 分辨率1 ℃/bit 偏移量40℃范围40℃~210℃ 类型测量255无效
/// </summary>
public sbyte GetOutTemperature { get; set; }
/// <summary>
/// 回水温度(电池到机组)
/// 分辨率1 ℃/bit 偏移量40℃范围40℃~210℃ 类型测量255无效
/// </summary>
public sbyte ComeBackTemperature { get; set; }
/// <summary>
/// 供应商编号
/// </summary>
public byte SupplierNumber { get; set; }
/// <summary>
/// 软件版本
/// </summary>
public byte SoftwareVersion { get; set; }
/// <summary>
/// TMS 需求功率高字节
/// 分辨率0.1 Kw/bit 偏移量0范围0Kw~100.0Kw 类型测量65535无效按照实时发送
/// </summary>
public byte TmsHighPower { get; set; }
/// <summary>
/// TMS 需求功率低字节
/// 分辨率0.1 Kw/bit 偏移量0范围0Kw~100.0Kw 类型测量65535无效按照实时发送
/// </summary>
public byte TmsLowPower { get; set; }
/// <summary>
/// TMS 故障码
/// 0无故障 出现 1 种以上循环发送
/// </summary>
public byte TmsTroubleCode { get; set; }
/// <summary>
/// crc校验帧
/// </summary>
public byte CrcCheckValue { get; set; }
}

@ -10,6 +10,7 @@ using HybirdFrameworkCore.Utils;
using HybirdFrameworkDriver.Session; using HybirdFrameworkDriver.Session;
using HybirdFrameworkDriver.TcpClient; using HybirdFrameworkDriver.TcpClient;
using log4net; using log4net;
using Microsoft.AspNetCore.Routing.Matching;
using Newtonsoft.Json; using Newtonsoft.Json;
using Repository.Station; using Repository.Station;
using Service.Charger.Codec; using Service.Charger.Codec;
@ -320,8 +321,11 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
CurrentCmd = JsonConvert.SerializeObject(remoteStartCharging, Formatting.Indented) + "\r\n" + CurrentCmd = JsonConvert.SerializeObject(remoteStartCharging, Formatting.Indented) + "\r\n" +
BitUtls.BytesToHexStr(remoteStartCharging.ToBytes()); BitUtls.BytesToHexStr(remoteStartCharging.ToBytes());
AuxiliaryPower auxiliaryPower = new AuxiliaryPower(1); AuxiliaryPower auxiliaryPower0 = new AuxiliaryPower(0);
this.Channel.WriteAndFlushAsync(auxiliaryPower); AuxiliaryPower auxiliaryPower1 = new AuxiliaryPower(1);
this.Channel.WriteAndFlushAsync(auxiliaryPower0);
Thread.Sleep(3000);
this.Channel.WriteAndFlushAsync(auxiliaryPower1);
this.Channel.WriteAndFlushAsync(remoteStartCharging); this.Channel.WriteAndFlushAsync(remoteStartCharging);
return Result<string>.Success(chargeOrderNo); return Result<string>.Success(chargeOrderNo);
} }
@ -666,7 +670,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
RedisHelper redisHelper = AppInfo.Container.Resolve<RedisHelper>(); RedisHelper redisHelper = AppInfo.Container.Resolve<RedisHelper>();
string? lockKey = redisHelper.GetStrValue($"chargeNo{BinNo}Start"); string? lockKey = redisHelper.GetStrValue($"chargeNo{BinNo}Start");
if (!string.IsNullOrWhiteSpace(lockKey)) if (!string.IsNullOrEmpty(lockKey))
{ {
return Result<bool>.Success(true, $"charger-{BinNo} is starting"); return Result<bool>.Success(true, $"charger-{BinNo} is starting");
} }

@ -27,10 +27,10 @@ namespace Service.Charger.Handler
msg.ChargerNo = sn; msg.ChargerNo = sn;
Log.Info($"receive {msg} from {sn}"); Log.Info($"receive {msg} from {sn}");
if (!AppSettingsConstVars.DisabledTask.Contains("UploadTelemetryData")) /*if (!AppSettingsConstVars.DisabledTask.Contains("UploadTelemetryData"))
{ {
RedisHelper.PublishAsync("UploadTelemetryData", JsonConvert.SerializeObject(msg)); RedisHelper.PublishAsync("UploadTelemetryData", JsonConvert.SerializeObject(msg));
} }*/
client.UploadTelemetryData = msg; client.UploadTelemetryData = msg;
//充电机实时充电功率 //充电机实时充电功率

@ -129,7 +129,7 @@ public class WaterCoolClient : TcpClient<IBaseHandler, Decoder, Encoder>
/// <summary> /// <summary>
/// 热管理策略 /// 热管理策略(开始充电调用)
/// 闭合继电器状态-延时300->上高压->按照策略开始液冷模式 /// 闭合继电器状态-延时300->上高压->按照策略开始液冷模式
/// </summary> /// </summary>
public void HeartManageStart() public void HeartManageStart()
@ -157,9 +157,8 @@ public class WaterCoolClient : TcpClient<IBaseHandler, Decoder, Encoder>
PowerOperate(0); PowerOperate(0);
} }
/// <summary> /// <summary>
/// 热管理策略 /// 热管理策略(停止充电调用)
/// 下高压->监测继电器状态(5s)->断开继电器 (停止失败做报警,手动处理报警) /// 下高压->监测继电器状态(5s)->断开继电器 (停止失败做报警,手动处理报警)
/// </summary> /// </summary>
public bool HeartManageStop() public bool HeartManageStop()
@ -192,7 +191,10 @@ public class WaterCoolClient : TcpClient<IBaseHandler, Decoder, Encoder>
return IsClose; return IsClose;
} }
//上高压 /// <summary>
/// 高压请求
/// </summary>
/// <param name="value"></param>
public void PowerOperate(byte value) public void PowerOperate(byte value)
{ {
if (msg.HighTension == value) if (msg.HighTension == value)
@ -214,17 +216,6 @@ public class WaterCoolClient : TcpClient<IBaseHandler, Decoder, Encoder>
msg.HighTension = value; msg.HighTension = value;
} }
/// <summary>
/// Tmax>=28℃且Tmean>=24℃
/// 进水口温度>=10℃则请求 TMS进行冷却。
/// 7℃进水口温度10℃若前一个模式为关机模式或制热模式或自循环模式则请求TMS进行自循环模式若前一个模式为制冷模式则请求TMS进行制冷模式
///进水口温度<=7℃则请求TMS进行自循环
/// Tmax<=24℃或Tmean<=22℃
/// </summary>
public void Strategy()
{
}
public bool Connect() public bool Connect()
{ {
base.BaseConnect(); base.BaseConnect();

@ -0,0 +1,70 @@
using AutoMapper;
using Entity.DbModel.Station;
using Entity.Dto.Resp;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Service.Charger.Client;
using Service.WaterCool.Client;
using Service.WaterCool.Msg.WaterCool;
namespace WebStarter.Controllers;
[Produces("application/json")]
[ApiController]
[Route("api/[controller]")]
public class WaterCoolControlller: ControllerBase
{
/// <summary>
/// 获取水冷机列表信息
/// </summary>
/// <returns>充电机code列表返回</returns>
[HttpGet]
[Route("GetWhaterCoolList")]
public async Task<Result<List<WaterCoolStatusResp>>> GetWhaterCoolList()
{
var vv = WaterCoolClientMgr.Dictionary.Values;
List<WaterCoolStatusResp> coolStatusResps = new();
var configuration = new MapperConfiguration(cfg => cfg.CreateMap<WaterCoolStatus, WaterCoolStatusResp>());
var mapper = configuration.CreateMapper();
foreach (var VARIABLE in vv)
{
if (VARIABLE != null && VARIABLE.WaterCoolStatus != null)
{
WaterCoolStatusResp coolStatusResp = new();
coolStatusResp=mapper.Map<WaterCoolStatusResp>(VARIABLE.WaterCoolStatus);
coolStatusResp.Sn = VARIABLE.Sn;
coolStatusResps.Add(coolStatusResp);
}
}
return Result<List<WaterCoolStatusResp>>.Success(coolStatusResps);
}
/*/// <summary>
/// 水冷机发送指令
/// </summary>
/// <returns>充电机code列表返回</returns>
[HttpGet]
[Route("SendModeMsg")]
public async Task<Result<List<WaterCoolStatusResp>>> SendModeMsg()
{
var vv = WaterCoolClientMgr.Dictionary.Values;
List<WaterCoolStatusResp> coolStatusResps = new();
var configuration = new MapperConfiguration(cfg => cfg.CreateMap<WaterCoolStatus, WaterCoolStatusResp>());
var mapper = configuration.CreateMapper();
foreach (var VARIABLE in vv)
{
if (VARIABLE != null && VARIABLE.WaterCoolStatus != null)
{
WaterCoolStatusResp coolStatusResp = new();
coolStatusResp=mapper.Map<WaterCoolStatusResp>(VARIABLE.WaterCoolStatus);
coolStatusResp.Sn = VARIABLE.Sn;
coolStatusResps.Add(coolStatusResp);
}
}
return Result<List<WaterCoolStatusResp>>.Success(coolStatusResps);
}*/
}
Loading…
Cancel
Save