From 8fb99de46ce93eb442b918d8973f3ff789ce1769 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期三, 07 五月 2025 07:01:02 +0800 Subject: [PATCH] 电流状态 --- ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dto/PowerNetFactorDTO.java | 8 +++- ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/PowerController.java | 47 +++++++++++++++++------ ansteel-biz/src/main/java/com/iailab/module/ansteel/power/entity/PowerNetFactorEntity.java | 14 +++++++ ansteel-biz/db/mysql.sql | 7 +++ 4 files changed, 61 insertions(+), 15 deletions(-) diff --git a/ansteel-biz/db/mysql.sql b/ansteel-biz/db/mysql.sql index 2726640..0a0e42a 100644 --- a/ansteel-biz/db/mysql.sql +++ b/ansteel-biz/db/mysql.sql @@ -251,6 +251,9 @@ ADD COLUMN `node_code` varchar(50) NULL DEFAULT NULL COMMENT '节点编号'; ALTER TABLE `t_power_net_factor` + ADD COLUMN `cur_a` varchar(50) NULL DEFAULT NULL COMMENT '当前电流' AFTER `node_name`; + +ALTER TABLE `t_power_net_factor` ADD COLUMN `p_limit_l` decimal(9, 3) NULL DEFAULT NULL COMMENT '有功下限'; ALTER TABLE `t_power_net_factor` ADD COLUMN `p_limit_h` decimal(9, 3) NULL DEFAULT NULL COMMENT '有功上限'; @@ -258,6 +261,10 @@ ADD COLUMN `q_limit_l` varchar(50) NULL DEFAULT NULL COMMENT '无功下限'; ALTER TABLE `t_power_net_factor` ADD COLUMN `q_limit_h` varchar(50) NULL DEFAULT NULL COMMENT '无功上限'; +ALTER TABLE `t_power_net_factor` + ADD COLUMN `cos_limit_l` varchar(50) NULL DEFAULT NULL COMMENT '无功下限'; +ALTER TABLE `t_power_net_factor` + ADD COLUMN `cos_limit_h` varchar(50) NULL DEFAULT NULL COMMENT '无功上限'; -- ---------------------------- -- 电力功率因数-发电机组实时状态 diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/PowerController.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/PowerController.java index cc1ca27..0640be5 100644 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/PowerController.java +++ b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/PowerController.java @@ -103,14 +103,23 @@ boolean cosFlag = false; try { List<String> points = new ArrayList<>(); + if (StringUtils.isNotBlank(entity.getCurA())) { + points.add(entity.getCurA()); + } if (StringUtils.isNotBlank(entity.getCurP())) { points.add(entity.getCurP()); } if (StringUtils.isNotBlank(entity.getCurQ())) { points.add(entity.getCurQ()); } + if (StringUtils.isNotBlank(entity.getCurCos())) { + points.add(entity.getCurCos()); + } if (!CollectionUtils.isEmpty(points)) { Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); + if (pointsRealValue.get(entity.getCurA()) != null) { + powerNetFactorDTO.setCurA(new BigDecimal(pointsRealValue.get(entity.getCurA()).toString())); + } if (pointsRealValue.get(entity.getCurP()) != null) { powerNetFactorDTO.setCurP(new BigDecimal(pointsRealValue.get(entity.getCurP()).toString())); } @@ -157,39 +166,51 @@ log.info(entity.getNodeName() + "获取预测值异常," + ex.getMessage()); } - // 设置功率因数状态 - if (cosFlag && powerNetFactorDTO.getCurCos() != null) { - BigDecimal curCos = powerNetFactorDTO.getCurCos(); - if (entity.getLimitL() != null && curCos.compareTo(entity.getLimitL()) < 0) { + // 设置电流状态 + if (powerNetFactorDTO.getCurA() != null) { + BigDecimal curA = powerNetFactorDTO.getCurA(); + if (entity.getLimitL() != null && curA.compareTo(entity.getLimitL()) < 0) { powerNetFactorDTO.setStatus(1); - } else if (entity.getLimitH() != null && curCos.compareTo(entity.getLimitH()) > 0) { + } else if (entity.getLimitH() != null && curA.compareTo(entity.getLimitH()) > 0) { powerNetFactorDTO.setStatus(1); } else { powerNetFactorDTO.setStatus(0); + } + } + + // 设置功率因数状态 + if (cosFlag && powerNetFactorDTO.getCurCos() != null) { + BigDecimal curCos = powerNetFactorDTO.getCurCos(); + if (entity.getCosLimitL() != null && curCos.compareTo(entity.getCosLimitL()) < 0) { + powerNetFactorDTO.setQStatus(1); + } else if (entity.getCosLimitH() != null && curCos.compareTo(entity.getCosLimitH()) > 0) { + powerNetFactorDTO.setQStatus(1); + } else { + powerNetFactorDTO.setQStatus(0); } } // 设置有功预警状态 if (powerNetFactorDTO.getCurP() != null) { BigDecimal curP = powerNetFactorDTO.getCurP(); - if (entity.getPLimitH() != null && curP.compareTo(entity.getPLimitL()) < 0) { - powerNetFactorDTO.setStatus(1); + if (entity.getPLimitL() != null && curP.compareTo(entity.getPLimitL()) < 0) { + powerNetFactorDTO.setPStatus(1); } else if (entity.getPLimitH() != null && curP.compareTo(entity.getPLimitH()) > 0) { - powerNetFactorDTO.setStatus(1); + powerNetFactorDTO.setPStatus(1); } else { - powerNetFactorDTO.setStatus(0); + powerNetFactorDTO.setPStatus(0); } } // 设置无功预警状态 if (powerNetFactorDTO.getCurQ() != null) { BigDecimal curQ = powerNetFactorDTO.getCurQ(); - if (entity.getQLimitH() != null && curQ.compareTo(entity.getQLimitL()) < 0) { - powerNetFactorDTO.setStatus(1); + if (entity.getQLimitL() != null && curQ.compareTo(entity.getQLimitL()) < 0) { + powerNetFactorDTO.setQStatus(1); } else if (entity.getQLimitH() != null && curQ.compareTo(entity.getQLimitH()) > 0) { - powerNetFactorDTO.setStatus(1); + powerNetFactorDTO.setQStatus(1); } else { - powerNetFactorDTO.setStatus(0); + powerNetFactorDTO.setQStatus(0); } } } diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dto/PowerNetFactorDTO.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dto/PowerNetFactorDTO.java index 56cbd9a..bb30840 100644 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dto/PowerNetFactorDTO.java +++ b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dto/PowerNetFactorDTO.java @@ -28,6 +28,9 @@ @Schema(description = "节点名称") private String nodeName; + @Schema(description = "当前电流") + private BigDecimal curA; + @Schema(description = "当前有功") private BigDecimal curP; @@ -55,7 +58,7 @@ @Schema(description = "下限") private BigDecimal limitL; - @Schema(description = "功率因数是否超限(0:正常,1:超限)") + @Schema(description = "是否有电流(0:无,1:有)") private Integer status; @Schema(description = "排序") @@ -67,5 +70,6 @@ @Schema(description = "无功是否超限(0:正常,1:超限)") private Integer qStatus; - + @Schema(description = "功率因数是否超限(0:正常,1:超限)") + private Integer cosStatus; } \ No newline at end of file diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/power/entity/PowerNetFactorEntity.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/power/entity/PowerNetFactorEntity.java index 7930ac2..803c52d 100644 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/power/entity/PowerNetFactorEntity.java +++ b/ansteel-biz/src/main/java/com/iailab/module/ansteel/power/entity/PowerNetFactorEntity.java @@ -36,6 +36,10 @@ */ private String nodeName; /** + * 当前电流 + */ + private String curA; + /** * 当前有功 */ private String curP; @@ -107,4 +111,14 @@ * 无功上限 */ private BigDecimal qLimitH; + + /** + * 功率因数下限 + */ + private BigDecimal cosLimitL; + + /** + * 功率因数上限 + */ + private BigDecimal cosLimitH; } \ No newline at end of file -- Gitblit v1.9.3