From b397edee2be2dfcc3f28eeac50298b4de26b1afa Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 13 十二月 2024 16:53:45 +0800 Subject: [PATCH] 取水口日取水量表中,出现一些大数,明显不正确,发析系统日志,发现一些阀控器会上报一些累计流量为0的数据,且无规律,推测是其不能从水表读取到累计流量时会上报0值。如果间歇上报0值,间歇上报一些非0值,非0值减去0值,就会出现大数,一天中出现几次那么会大数进行累加,数值将更大。为此变更算法,规避这种情况,但也会丢失一些流量值。 --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java index 6f95d48..c504d5c 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java @@ -2,9 +2,12 @@ import com.dy.common.mw.protocol.*; import com.dy.common.mw.protocol.p206V1.ProtocolConstantV206V1; +import com.dy.common.mw.protocol.p206V2.ProtocolConstantV206V2; import com.dy.common.util.DateTime; -@AnnotationDriver(name= ProtocolConstantV206V202404.protocolName) +@AnnotationDriver(enable = true, + name= ProtocolConstantV206V202404.protocolName, + version= ProtocolConstantV206V202404.protocolVer) public class DriverV202404 extends Driver { private static String scanRootPackage = "com.dy.common.mw.protocol.p206V202404" ; @@ -14,7 +17,6 @@ private ParseParamsForDownV202404 downCpParams ; private Boolean reportOrResponse_trueOrFalse = null ; - private String rtuAddrInData = null ; public DriverV202404(){ upCpParams = new ParseParamsForUpV202404() ; @@ -33,7 +35,6 @@ this.downCpParams.clear(); } this.reportOrResponse_trueOrFalse = null ; - this.rtuAddrInData = null ; } /** @@ -60,13 +61,12 @@ String upCode = null ; try{ CommonV202404 cp = new CommonV202404() ; - cp.checkHead(upBuffer) ; + Boolean p202404TrueUgFalse = cp.protocolType_p206TrueUgFalse(upBuffer) ; cp.checkTail(upBuffer) ; - String crcStr = cp.checkCrc_str(upBuffer) ; + String crcStr = cp.checkCrc_str(upBuffer, p202404TrueUgFalse) ; if(crcStr != null){ return new MidResult[]{(new MidResultError(ProtocolConstantV206V202404.protocolName, rtuAddr, "涓ラ噸閿欒锛屼笂琛屾暟鎹瓹RC妫�鏌ュけ璐ワ紝" + crcStr, null))} ; } - rtuAddr = cp.parseRtuAddr(upBuffer) ; upCode = cp.parseCode(upBuffer) ; if(upCode == null){ return new MidResult[]{(new MidResultError(ProtocolConstantV206V202404.protocolName, rtuAddr, "涓ラ噸閿欒锛屾湭鑳戒粠涓婅鏁版嵁涓В鏋愬嚭鍔熻兘鐮侊紒", null))} ; @@ -88,6 +88,7 @@ upData.setSubData(dV201) ; this.upCpParams.setValue(ProtocolConstantV206V202404.protocolName, + ProtocolConstantV206V202404.protocolVer, rtuAddr, upCode, upHex, @@ -101,7 +102,11 @@ @Override public void callback(Boolean flag) { reportOrResponse_trueOrFalse = flag ; - rtuAddrInData = dV201.getRtuAddr() ; + //rtuAddrInData = dV201.getRtuAddr() ; + } + @Override + public void notify(NotifyInfo ...infos) { + notify.notify(rtuAddr, ProtocolConstantV206V1.protocolName, ProtocolConstantV206V1.protocolVer, infos); } }); } @@ -136,7 +141,8 @@ this.downCpParams.setValue( RtuResultSendWebUrl, - ProtocolConstantV206V202404.protocolName, + ProtocolConstantV206V202404.protocolName, + command.protocolVersion==null?ProtocolConstantV206V202404.protocolVer:command.protocolVersion, rtuAddr, command.getId(), commandCode, -- Gitblit v1.8.0