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-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V202404/TkPreGenObjsV202404.java | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V202404/TkPreGenObjsV202404.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V202404/TkPreGenObjsV202404.java index 71869a8..53bb25c 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V202404/TkPreGenObjsV202404.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V202404/TkPreGenObjsV202404.java @@ -1,11 +1,16 @@ package com.dy.rtuMw.server.rtuData.p206V202404; +import com.dy.common.mw.protocol.Command; +import com.dy.common.mw.protocol.CommandType; import com.dy.common.mw.protocol.Data; +import com.dy.common.mw.protocol.p206V202404.CodeV202404; import com.dy.common.springUtil.SpringContextUtil; import com.dy.pipIrrGlobal.pojoPr.PrController; import com.dy.pipIrrGlobal.pojoPr.PrControllerTramp; +import com.dy.rtuMw.server.ServerProperties; import com.dy.rtuMw.server.rtuData.TaskSurpport; import com.dy.rtuMw.server.rtuData.dbSv.DbSv; +import com.dy.rtuMw.web.com.CommandCtrl; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -39,7 +44,10 @@ //娴佹氮鑰呮帶鍒跺櫒 controllerTramp = sv.getPrControllerTrampByRtuAddr(rtuAddr); if(controllerTramp == null){ - controllerTramp = new PrControllerTramp(null, rtuAddr, d.getProtocol(), new Date()) ; + //绗竴娆″彂鐜� + controllerTramp = new PrControllerTramp(null, rtuAddr, d.getProtocol(), (d.protocolVer==null?null:d.protocolVer.intValue()), new Date(), ServerProperties.orgTag) ; + //绗竴娆″彂鐜帮紝涓嬪彂娓呯┖RTU鍘嗗彶鍛戒护锛屼互浣垮叾閲嶆柊寮�濮嬭褰曟柊鍦扮偣鐨勬暟鎹� + this.sendClearCommand(rtuAddr, d.protocol); } } //涓嶈鏄惁涓烘祦娴帶鍒跺櫒锛圧TU瀹炰綋锛夛紝閮借杩涜涓嬫宸ヤ綔锛岃褰曞叾涓婃姤鐨勪竴浜涙暟鎹紝褰撶粦瀹氭帶鍒跺櫒鍚庯紝鏁版嵁鑷姩鏈変簡褰掑睘 @@ -49,4 +57,25 @@ log.error("涓ラ噸閿欒锛屾湭鑳藉緱鍒癉bSv瀵硅薄"); } } + + /** + * 鍙戦�佹竻绌篟TU鐨勫懡浠� + * @param rtuAddr + * @param protocol + */ + private void sendClearCommand(String rtuAddr, String protocol){ + Command com = new Command() ; + com.id = Command.defaultId ; + com.rtuAddr = rtuAddr ; + com.protocol = protocol ; + com.type = CommandType.outerCommand; + com.code = CodeV202404.cd_99 ;//褰撳墠鏄痯206V202404鍗忚鐨勪换鍔� + com.rtuResultSendWebUrl = Command.ignoreRtuResultSendWebUrl ; + com.param = null ; + com.attachment = null ; + CommandCtrl comCtrl = SpringContextUtil.getBean(CommandCtrl.class) ; + if(comCtrl != null){ + comCtrl.sendOutComFromLocal(com) ; + } + } } -- Gitblit v1.8.0