From 25d9ad8d8eaf11d23d0aca2ce232c17cc9292afc Mon Sep 17 00:00:00 2001 From: rszn <645583145@qq.com> Date: Tue, 25 Jun 2024 09:41:46 +0800 Subject: [PATCH] =?UTF-8?q?modbus=20=E5=AD=97=E5=BA=8Fbug=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Common/lib/HybirdFrameworkCore.dll | Bin 39936 -> 39936 bytes Service/Charger/Client/ChargerClient.cs | 48 +++++++++++++----------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/Common/lib/HybirdFrameworkCore.dll b/Common/lib/HybirdFrameworkCore.dll index e5693b3641afbcd94480f3ed41d6b74c7298f978..8c29e7398b13453838a34bf95c8a091efbf4ac0c 100644 GIT binary patch delta 8200 zcmZu$33yc1+5XPmXT39%$v%_Cgg_ubA|YW3LL@=95HKvEp-7m7LXFxeDpX_=f}tRa z=}iK$P!pg?${GeMwxB^Mf;jlt?HfmWgc1Z~67>y`^ z4A~O^dQ|{0qoFA`G*P&&1RubV2H*za`FXK7C7YTdgJADdgz~vk%(O;1cw~Bn)TcKn z7Qqrz+OSr!M3)MdSYk2AxD$)#Xmr35SL(31rJGWO?3Vi;RqTC0>kSc^0`$SQEW9l- z`X;j~8CDRCKUp4PRwLc|AhQ`w)?#KiKC=#B4kOl@FicK9QwhPLeS%J{omxe1Dc|bi|KiJ@H6-LR*2g%Kn22~jF`i`@a#9NN^rU#i!leGJPw4Taml*47 zMBeou)-U8v8O~ULV^V4v%QUv7hFF$S-Xogb9a`8UQD6f?Ej>SEEZe9~f0hjl-AKoh zIiYoZuuQITIwQmeg&O)sGd4KX-mjRkA;x$8i!IrBaZ(lov>KB#Ba*L;1IUxnnNkAT zlK@;e?3DYaj48l#0qReUXEMjJA))s&FDb!aInrRDzS5y6h2lPSYK=W{m1Ann3W?*d z{TxpuaO~&i__dScb=N9KG89?@S{SpyEgFt2_#c7eWx~73$s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ED_jlmh`_=6oN+EqU0WV>9cRN=O9nJ2J9oa;@IC*BruD*w+c2FCtRo|!r+X5hz8Q~RHYGw?sNkX-M1 zdERYfHLE7YFv(mx>Ag^xEr5%-v#S!u(y>BV4+rr0gYW?z2ZT~sA*A3@%uXp2m`9xp zcdEZ&3y0LNruCLVQ;Vr;uW=;>T8JnL)_ zUUxDWhHF0zL_8q!;pB!4(;Sv`4XmJ;#bM}nvnOV8z zWi!jOW>)6(%E>M7m)kcdud-j?yz-p9@~mE!S^dh&v&$o$%{-QUe9+`S11lQC&+Q|4 zJcIv|e&)vC%}_HuV({pMhl>B2R?WKlG-LiD|MNu`XWSh*nR(CGQ!}QTZT0u}vdkwg zTP82Pe{|`z``f3T%YWg>W8 { - #region 属性 /// @@ -50,9 +49,8 @@ public class ChargerClient : TcpClient /// 是否已经开始充电 /// public bool IsCharged { get; set; } = false; - - - + + /// /// 站外两枪时是否在充电 /// @@ -61,6 +59,7 @@ public class ChargerClient : TcpClient [1] = false, [2] = false }; + /// /// 充电桩连接状态 /// @@ -69,7 +68,7 @@ public class ChargerClient : TcpClient [1] = false, [2] = false }; - + public bool IsStopped { get; set; } = false; public bool IsCanSendStopCmd { get; set; } = true; @@ -151,30 +150,32 @@ public class ChargerClient : TcpClient /// 充电机遥测数据 /// public UploadTelemetryData UploadTelemetryData = new UploadTelemetryData(); - + /// /// 充放电机上传单体动力蓄电池电压极值统计 /// public VoltageExtremumStatistics? VoltageExtremumStatistics = new VoltageExtremumStatistics(); - + /// /// 充电桩的遥测 /// public ConcurrentDictionary PileUploadTelemetry = new(); + /// /// 充电桩的遥信 /// public ConcurrentDictionary PileUploadRemoteSignal = new(); - + /// /// 充电桩状态信息 /// public ConcurrentDictionary ChargerPile = new(); + /// ///充电机实时充电功率 /// public float RealTimeChargePower { get; set; } = 0; - + /// /// 心跳-桩状态 /// @@ -460,7 +461,7 @@ public class ChargerClient : TcpClient BitUtls.BytesToHexStr(setPeakValleyTime.ToBytes()); this.Channel.WriteAndFlushAsync(setPeakValleyTime); - Log().Info($"SendSetPeakValleyTime{CurrentCmd} to chargeOrderNo={BinNo}"); + Log().Info($"SendSetPeakValleyTime{CurrentCmd} to chargeOrderNo={BinNo}"); return Result.Success(); } @@ -498,6 +499,7 @@ public class ChargerClient : TcpClient this.Channel.WriteAndFlushAsync(req); return Result.Success(); } + /// /// 3.7.1 监控平台远程启动充电桩充电 /// @@ -507,7 +509,8 @@ public class ChargerClient : TcpClient /// 功率调节参数 /// /// 充电流水号 - public Result SendStartOutCharger(byte pn, byte socValue, short changePower=360,byte changePowerCmdType=1 , + public Result SendStartOutCharger(byte pn, byte socValue, short changePower = 360, + byte changePowerCmdType = 1, string? chargeOrderNo = null) { if (!Connected) @@ -523,12 +526,14 @@ public class ChargerClient : TcpClient Log().Info( $"SendStartOutCharger pn={pn}, socValue={socValue}, changePower={changePower}, changePowerCmdType={changePowerCmdType}, chargeOrderNo={chargeOrderNo}"); - PileStartCharge pileStartCharge = new PileStartCharge(pn, socValue, changePowerCmdType, changePower,chargeOrderNo); - + PileStartCharge pileStartCharge = + new PileStartCharge(pn, socValue, changePowerCmdType, changePower, chargeOrderNo); + this.Channel.WriteAndFlushAsync(pileStartCharge); return Result.Success(chargeOrderNo); } + /// /// 3.7.3 监控平台远程停止充电桩充电 /// @@ -541,32 +546,33 @@ public class ChargerClient : TcpClient { return Result.Fail($"充电机{BinNo}未连接"); } - + Log().Info( $"SendStartOutCharger pn={pn}, stopReason={stopReason}"); - PileStopCharge pileStopCharge=new PileStopCharge(pn,stopReason); + PileStopCharge pileStopCharge = new PileStopCharge(pn, stopReason); this.Channel.WriteAndFlushAsync(pileStopCharge); return Result.Success(); } - + /// /// 3.7.9 监控平台发送充电桩功率调节指令 /// /// /// /// - public Result SendPileAdjustPower(byte pn,float expectedOperatingPower) + public Result SendPileAdjustPower(byte pn, float expectedOperatingPower) { if (!Connected) { return Result.Fail($"charger-{BinNo} disconnect"); } - PileAdjustPower powerRegulation = new PileAdjustPower(pn,expectedOperatingPower); + PileAdjustPower powerRegulation = new PileAdjustPower(pn, expectedOperatingPower); this.Channel.WriteAndFlushAsync(powerRegulation); return Result.Success(); } + /// /// /// @@ -592,7 +598,7 @@ public class ChargerClient : TcpClient /// /// /// - public Result StartCharge(byte chargeSoc, float chargePower) + public Result StartCharge(byte chargeSoc, float chargePower) { if (string.IsNullOrWhiteSpace(BinNo)) { @@ -616,12 +622,12 @@ public class ChargerClient : TcpClient return Result.Fail($"charger-{BinNo} battery not exist"); } - if (binInfo.AmtLock == 1) + if (binInfo.AmtLock == 1) { return Result.Fail($"仓-{BinNo} 被锁定"); } - if (binInfo.CanChargeFlag == 0) + if (binInfo.CanChargeFlag == 0) { return Result.Fail($"仓-{BinNo} 被禁用"); }