| | |
| | | put("F0000101185", Arrays.asList("F0000100098", "F0000100099", "F0000100100", "F0000100101")); |
| | | put("F0000101186", Arrays.asList("F0000100109", "F0000100110", "F0000100111", "F0000100112")); |
| | | put("F0000101187", Arrays.asList("M0000100009", "M0000100023", "M0000100026", "M0000100029")); |
| | | put("F0000101188", Arrays.asList("M0000100854", "M0000100855", "M0000100856", "M0000100857")); |
| | | put("F0000101189", Arrays.asList("M0000100010", "M0000100024", "M0000100027", "M0000100030")); |
| | | put("F0000101190", Arrays.asList("C0000101199", "C0000101200", "C0000101201", "C0000101202")); |
| | | put("F0000101191", Arrays.asList("M0000100854", "M0000100855", "M0000100856", "M0000100857")); |
| | |
| | | put("F0000101228", Arrays.asList("F0000101195", "F0000101206", "F0000101217", "C0000101220")); |
| | | }}; |
| | | |
| | | private static final HashMap<String, List<String>> qhPoints = new HashMap<String, List<String>>() {{ |
| | | put("1", Arrays.asList("F0000100098", "F0000100099", "F0000100100", "F0000100101","F0000100105", "F0000100106", "F0000100107", "F0000100108","F0000100102", "F0000100103")); |
| | | }}; |
| | | |
| | | private boolean qhFlag1 = false; |
| | | private boolean qhFlag2 = false; |
| | | private boolean qhFlag135 = false; |
| | |
| | | logger.info("RunMachineStateTask定时任务正在执行,参数为:{}", params); |
| | | try { |
| | | List<String> partPointNos = partPoints.values().stream().flatMap(List::stream).collect(Collectors.toList()); |
| | | partPointNos.add("M0000100011"); |
| | | partPointNos.add("M0000100012"); |
| | | Map<String, Object> partPointsRealValue = dataPointApi.queryPointsRealValue(partPointNos); |
| | | logger.info("运行状态点值:{}", partPointsRealValue); |
| | | List<String> qhPointNos = qhPoints.values().stream().flatMap(List::stream).collect(Collectors.toList()); |
| | | Map<String, Object> qhPointsRealValue = dataPointApi.queryPointsRealValue(qhPointNos); |
| | | for (Map.Entry<String, List<String>> entry : qhPoints.entrySet()) { |
| | | for (String pointNo : entry.getValue()) { |
| | | Double value = Double.valueOf(String.format("%.2f", Double.valueOf(qhPointsRealValue.get(pointNo).toString()))); |
| | | if ("F0000100098".equals(pointNo) && value == 0.00) { |
| | | partPointsRealValue.replace("F0000100109", 0); |
| | | partPointsRealValue.replace("C0000101223", 0); |
| | | partPointsRealValue.replace("C0000101210", 0); |
| | | partPointsRealValue.replace("C0000101214", 0); |
| | | partPointsRealValue.replace("M0000100854", 0); |
| | | }else if ("F0000100099".equals(pointNo) && value == 0.00) { |
| | | partPointsRealValue.replace("F0000100110", 0); |
| | | partPointsRealValue.replace("C0000101224", 0); |
| | | partPointsRealValue.replace("C0000101211", 0); |
| | | partPointsRealValue.replace("C0000101215", 0); |
| | | partPointsRealValue.replace("M0000100855", 0); |
| | | }else if ("F0000100100".equals(pointNo) && value == 0.00) { |
| | | partPointsRealValue.replace("F0000100111", 0); |
| | | partPointsRealValue.replace("C0000101225", 0); |
| | | partPointsRealValue.replace("C0000101212", 0); |
| | | partPointsRealValue.replace("C0000101216", 0); |
| | | partPointsRealValue.replace("M0000100856", 0); |
| | | }else if ("F0000100101".equals(pointNo) && value == 0.00) { |
| | | partPointsRealValue.replace("F0000100112", 0); |
| | | partPointsRealValue.replace("C0000101226", 0); |
| | | partPointsRealValue.replace("C0000101213", 0); |
| | | partPointsRealValue.replace("C0000101217", 0); |
| | | partPointsRealValue.replace("M0000100857", 0); |
| | | }else if ("F0000100105".equals(pointNo) && value == 0.00) { |
| | | partPointsRealValue.replace("F0000100116", 0); |
| | | partPointsRealValue.replace("C0000101227", 0); |
| | | }else if ("F0000100106".equals(pointNo) && value == 0.00) { |
| | | partPointsRealValue.replace("F0000100117", 0); |
| | | partPointsRealValue.replace("C0000101228", 0); |
| | | }else if ("F0000100107".equals(pointNo) && value == 0.00) { |
| | | partPointsRealValue.replace("F0000100118", 0); |
| | | partPointsRealValue.replace("C0000101229", 0); |
| | | }else if ("F0000100108".equals(pointNo) && value == 0.00) { |
| | | partPointsRealValue.replace("F0000100119", 0); |
| | | partPointsRealValue.replace("C0000101230", 0); |
| | | }else if ("F0000100102".equals(pointNo) && value == 0.00) { |
| | | partPointsRealValue.replace("F0000100113", 0); |
| | | partPointsRealValue.replace("C0000101231", 0); |
| | | partPointsRealValue.replace("C0000101221", 0); |
| | | partPointsRealValue.replace("C0000101218", 0); |
| | | partPointsRealValue.replace("C0000101114", 0); |
| | | partPointsRealValue.replace("C0000101116", 0); |
| | | //若其中一个135MW气耗率为0,则剩下那个135MW机组BFG、LDG取“动力总厂135MW发电机组BFG使用瞬时流量(M0000100011)“,”动力总厂135MW发电机组LDG使用瞬时流量(M0000100012) |
| | | partPointsRealValue.replace("C0000101115", partPointsRealValue.get("M0000100011")); |
| | | partPointsRealValue.replace("C0000101117", partPointsRealValue.get("M0000100012")); |
| | | }else if ("F0000100103".equals(pointNo) && value == 0.00) { |
| | | partPointsRealValue.replace("F0000100114", 0); |
| | | partPointsRealValue.replace("C0000101232", 0); |
| | | partPointsRealValue.replace("C0000101222", 0); |
| | | partPointsRealValue.replace("C0000101219", 0); |
| | | partPointsRealValue.replace("C0000101115", 0); |
| | | partPointsRealValue.replace("C0000101117", 0); |
| | | partPointsRealValue.replace("C0000101114", partPointsRealValue.get("M0000100011")); |
| | | partPointsRealValue.replace("C0000101116", partPointsRealValue.get("M0000100012")); |
| | | } |
| | | } |
| | | } |
| | | logger.info("替换后的点位值:{}", partPointsRealValue); |
| | | for (Map.Entry<String, List<String>> entry : partPoints.entrySet()) { |
| | | ApiPointValueWriteDTO writeDTO = new ApiPointValueWriteDTO(); |
| | | double dataValue = 0d; |
| | |
| | | logger.info("写入常量点="+writeDTO.getPointNo()+",值="+writeDTO.getValue()); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | } |
| | | ApiPointValueWriteDTO apiPointValueWriteDTO = new ApiPointValueWriteDTO(); |
| | | if(qhFlag1){ |
| | | logger.info("一期机组气耗率为0"); |
| | | apiPointValueWriteDTO.setValue(0); |
| | | apiPointValueWriteDTO.setPointNo("F0000101193"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | apiPointValueWriteDTO.setPointNo("F0000101194"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | apiPointValueWriteDTO.setPointNo("F0000101195"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | } |
| | | if(qhFlag2){ |
| | | logger.info("二期机组气耗率为0"); |
| | | apiPointValueWriteDTO.setValue(0); |
| | | apiPointValueWriteDTO.setPointNo("F0000101204"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | apiPointValueWriteDTO.setPointNo("F0000101205"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | apiPointValueWriteDTO.setPointNo("F0000101206"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | } |
| | | if(qhFlag135){ |
| | | logger.info("135机组气耗率为0"); |
| | | apiPointValueWriteDTO.setValue(0); |
| | | apiPointValueWriteDTO.setPointNo("F0000101215"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | apiPointValueWriteDTO.setPointNo("F0000101216"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | apiPointValueWriteDTO.setPointNo("F0000101217"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | } |
| | | if(qhFlag180){ |
| | | logger.info("180机组气耗率为0"); |
| | | apiPointValueWriteDTO.setValue(0); |
| | | apiPointValueWriteDTO.setPointNo("C0000101233"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | apiPointValueWriteDTO.setPointNo("C0000101220"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | } |
| | | Thread.sleep(5000); |
| | | List<String> sumPointNos = sumPoints.values().stream().flatMap(List::stream).collect(Collectors.toList());//合计 |
| | | Map<String, Object> totalPointsRealValue = dataPointApi.queryPointsRealValue(sumPointNos); |
| | |
| | | logger.info("写入常量点="+writeDTO.getPointNo()+",值="+writeDTO.getValue()); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | } |
| | | ApiPointValueWriteDTO writeDTO = new ApiPointValueWriteDTO(); |
| | | if(qhFlag1){ |
| | | logger.info("一期机组气耗率为0"); |
| | | writeDTO.setValue(0); |
| | | writeDTO.setPointNo("F0000101193"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | writeDTO.setPointNo("F0000101194"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | writeDTO.setPointNo("F0000101195"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | } |
| | | if(qhFlag2){ |
| | | logger.info("二期机组气耗率为0"); |
| | | writeDTO.setValue(0); |
| | | writeDTO.setPointNo("F0000101204"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | writeDTO.setPointNo("F0000101205"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | writeDTO.setPointNo("F0000101206"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | } |
| | | if(qhFlag135){ |
| | | logger.info("135机组气耗率为0"); |
| | | writeDTO.setValue(0); |
| | | writeDTO.setPointNo("F0000101215"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | writeDTO.setPointNo("F0000101216"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | writeDTO.setPointNo("F0000101217"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | } |
| | | if(qhFlag180){ |
| | | logger.info("180机组气耗率为0"); |
| | | writeDTO.setValue(0); |
| | | writeDTO.setPointNo("C0000101233"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | writeDTO.setPointNo("C0000101220"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | } |
| | | |
| | | if(qhFlagTotal){ |
| | | logger.info("合计气耗率为0"); |
| | | writeDTO.setValue(0); |
| | | writeDTO.setPointNo("F0000101226"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | writeDTO.setPointNo("F0000101227"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | writeDTO.setPointNo("F0000101228"); |
| | | dataPointApi.writePointRealValue(writeDTO); |
| | | apiPointValueWriteDTO = new ApiPointValueWriteDTO(); |
| | | apiPointValueWriteDTO.setValue(0); |
| | | apiPointValueWriteDTO.setPointNo("F0000101226"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | apiPointValueWriteDTO.setPointNo("F0000101227"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | apiPointValueWriteDTO.setPointNo("F0000101228"); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | } |
| | | |
| | | qhFlag1 = false; |
| | | qhFlag2 = false; |
| | | qhFlag135 = false; |
| | | qhFlag180 = false; |
| | | qhFlagTotal = false; |
| | | |
| | | } catch (Exception ex) { |
| | | logger.error("RunMachineStateTask运行异常", ex); |
| | | } |