| | |
| | | import com.dy.common.mw.support.SupportUnit; |
| | | import com.dy.common.mw.support.SupportUnitConfigVo; |
| | | import com.dy.rtuMw.server.tasks.SendMsConstantTask; |
| | | import com.dy.rtuMw.server.tasks.ToRtuConstantTask; |
| | | import com.dy.rtuMw.server.tasks.RtuDownConstantTask; |
| | | import com.dy.rtuMw.resource.ResourceUnit; |
| | | import com.dy.rtuMw.resource.ResourceUnitConfigVo; |
| | | import com.dy.common.springUtil.SpringContextUtil; |
| | | import com.dy.common.util.ConfigXml4Springboot; |
| | | import com.dy.common.util.IDLongGenerator; |
| | | |
| | | import com.dy.rtuMw.server.upgrade.UpgradeUnit; |
| | | import com.dy.rtuMw.server.upgrade.UpgradeUnitConfigVo; |
| | | import org.jdom2.Document; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | */ |
| | | |
| | | ///////////////// |
| | | //RTU远程升级模块 |
| | | UpgradeUnitConfigVo ugVo = new UpgradeUnitConfigVo(); |
| | | ugVo.enable = conf.getSetAttrBoolean(doc, "config.upgrade", "enable", null, null) ; |
| | | ugVo.noOneRtuUpgradeMaxDuration = conf.getSetAttrPlusInt(doc, "config.upgrade", "noOneRtuUpgradeMaxDuration", null, 5, 360000, null); |
| | | ugVo.noOneRtuUpgradeMaxDuration = ugVo.noOneRtuUpgradeMaxDuration * 1000 ;//变成毫秒 |
| | | ugVo.failTryTimes = conf.getSetAttrPlusInt(doc, "config.upgrade", "failTryTimes", null, 0, 100, null); |
| | | ugVo.ugMaxRtuAtOnce = conf.getSetAttrPlusInt(doc, "config.upgrade", "ugMaxRtuAtOnce", null, 0, 1000000, null); |
| | | ugVo.rtuOffLineWaitDuration = conf.getSetAttrPlusInt(doc, "config.upgrade", "rtuOffLineWaitDuration", null, 1, 3600000, null); |
| | | ugVo.rtuOffLineWaitDuration = ugVo.rtuOffLineWaitDuration * 1000;//变成毫秒 |
| | | ugVo.notifyStateInterval = conf.getSetAttrPlusInt(doc, "config.upgrade", "notifyStateInterval", null, 1, 300, null); |
| | | ugVo.notifyStateInterval = ugVo.notifyStateInterval * 1000;//变成毫秒 |
| | | ugVo.showStartInfo = showStartInfo ; |
| | | AdapterImp_UpgradeUnit ugAdap = new AdapterImp_UpgradeUnit(); |
| | | ugAdap.setConfig(ugVo); |
| | | UpgradeUnit ugUnit = UpgradeUnit.getInstance(); |
| | | ugUnit.setAdapter(ugAdap); |
| | | ugUnit.start(obj -> { |
| | | }); |
| | | units.add(ugUnit) ; |
| | | |
| | | ///////////////// |
| | | //RTU上行数据处理模块(任务树) |
| | | RtuDataUnitConfigVo rducVo = new RtuDataUnitConfigVo(); |
| | | rducVo.resourceLoader = this.resourceLoader ; |
| | |
| | | // /////////////// |
| | | // 核心 |
| | | CoreUnitConfigVo coreConfVo = new CoreUnitConfigVo(); |
| | | coreConfVo.sleepBigBusy = conf.getSetAttrPlusInt(doc, "config.core", "sleepBigBusy", null, 1, 200, null).longValue() ; |
| | | coreConfVo.sleepSmallBusy = conf.getSetAttrPlusInt(doc, "config.core", "sleepSmallBusy", null, 2, 1000, null).longValue(); |
| | | coreConfVo.coreInterval = conf.getSetAttrPlusInt(doc, "config.core", "coreInterval", null, 1, 200, null).longValue() ; |
| | | coreConfVo.queueWarnSize = ServerProperties.cacheUpDownDataWarnCount ; |
| | | coreConfVo.queueMaxSize = ServerProperties.cacheUpDownDataMaxCount ; |
| | | coreConfVo.showStartInfo = showStartInfo ; |
| | |
| | | coreAdap.setConfig(coreConfVo); |
| | | CoreUnit coreUnit = CoreUnit.getInstance(); |
| | | coreUnit.setAdapter(coreAdap); |
| | | CoreUnit.addConstantTask(new ToRtuConstantTask()); |
| | | CoreUnit.addConstantTask(new RtuDownConstantTask()); |
| | | CoreUnit.addConstantTask(new FromRtuDataConstantTask()); |
| | | CoreUnit.addConstantTask(new FromRtuComResultConstantTask()); |
| | | CoreUnit.addConstantTask(new SendMsConstantTask()); |