鞍钢鲅鱼圈能源管控系统后端代码
潘志宝
6 天以前 8fb99de46ce93eb442b918d8973f3ff789ce1769
电流状态
已修改4个文件
76 ■■■■ 文件已修改
ansteel-biz/db/mysql.sql 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/PowerController.java 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dto/PowerNetFactorDTO.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ansteel-biz/src/main/java/com/iailab/module/ansteel/power/entity/PowerNetFactorEntity.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 '无功上限';
-- ----------------------------
-- 电力功率因数-发电机组实时状态
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);
                }
            }
        }
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;
}
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;
}