feat(add-ledger): 新增线路类型和设备单位管理功能
- 添加线路类型常量定义(主网0,配网1)及验证逻辑 - 新增设备单位查询和保存接口及实现 - 新增监测点限值查询接口 - 扩展AddLedgerDetailVO和AddLedgerLinePO实体类以支持线路类型字段 - 在测点保存时自动计算并保存限值信息 - 添加设备单位默认配置初始化逻辑 - 新增COverlimitUtil工具类用于限值计算 - 完善相关单元测试用例
This commit is contained in:
@@ -6,10 +6,13 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddDeviceUnitSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerEngineeringSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerEquipmentSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerLineSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerProjectSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddOverlimitPO;
|
||||
import com.njcn.gather.tool.addledger.pojo.vo.AddDeviceUnitVO;
|
||||
import com.njcn.gather.tool.addledger.pojo.vo.AddLedgerDetailVO;
|
||||
import com.njcn.gather.tool.addledger.pojo.vo.AddLedgerTreeNodeVO;
|
||||
import com.njcn.gather.tool.addledger.service.AddLedgerService;
|
||||
@@ -93,6 +96,26 @@ public class AddLedgerController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("查询设备单位")
|
||||
@GetMapping("/equipment/unit")
|
||||
public HttpResult<AddDeviceUnitVO> getDeviceUnit(@RequestParam("devId") String devId) {
|
||||
String methodDescribe = getMethodDescribe("getDeviceUnit");
|
||||
LogUtil.njcnDebug(log, "{},开始查询设备单位,devId={}", methodDescribe, devId);
|
||||
AddDeviceUnitVO result = addLedgerService.getDeviceUnit(devId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||
@ApiOperation("保存设备单位")
|
||||
@PostMapping("/equipment/unit/save")
|
||||
public HttpResult<AddDeviceUnitVO> saveDeviceUnit(@RequestBody @Validated AddDeviceUnitSaveParam param) {
|
||||
String methodDescribe = getMethodDescribe("saveDeviceUnit");
|
||||
LogUtil.njcnDebug(log, "{},开始保存设备单位,devId={}", methodDescribe, param.getDevId());
|
||||
AddDeviceUnitVO result = addLedgerService.saveDeviceUnit(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
@ApiOperation("新增或保存测点")
|
||||
@PostMapping("/line/save")
|
||||
@@ -103,6 +126,16 @@ public class AddLedgerController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("查询监测点限值")
|
||||
@GetMapping("/line/overlimit")
|
||||
public HttpResult<AddOverlimitPO> getLineOverlimit(@RequestParam("lineId") String lineId) {
|
||||
String methodDescribe = getMethodDescribe("getLineOverlimit");
|
||||
LogUtil.njcnDebug(log, "{},开始查询监测点限值,lineId={}", methodDescribe, lineId);
|
||||
AddOverlimitPO result = addLedgerService.getLineOverlimit(lineId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("查询设备可用线路号")
|
||||
@GetMapping("/line/availableLineNos")
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.njcn.gather.tool.addledger.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddDeviceUnit;
|
||||
|
||||
/**
|
||||
* 设备单位 Mapper。
|
||||
*/
|
||||
public interface AddDeviceUnitMapper extends BaseMapper<AddDeviceUnit> {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.njcn.gather.tool.addledger.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddOverlimitPO;
|
||||
|
||||
/**
|
||||
* 监测点限值 Mapper。
|
||||
*/
|
||||
public interface AddOverlimitMapper extends BaseMapper<AddOverlimitPO> {
|
||||
}
|
||||
@@ -33,12 +33,19 @@ public final class AddLedgerConst {
|
||||
public static final int LINE_RUN_STATUS_RUNNING = 0;
|
||||
public static final int LINE_INTERVAL_DEFAULT = 1;
|
||||
public static final String LOG_LEVEL_WARN = "WARN";
|
||||
public static final int LINE_TYPE_MAIN = 0;
|
||||
public static final int LINE_TYPE_DISTRIBUTION = 1;
|
||||
|
||||
public static final int MIN_LINE_NO = 1;
|
||||
public static final int MAX_LINE_NO = 20;
|
||||
|
||||
public static final Set<Integer> CON_TYPES = new LinkedHashSet<Integer>(Arrays.asList(0, 1, 2));
|
||||
|
||||
public static final Set<Integer> LINE_TYPES = new LinkedHashSet<Integer>(Arrays.asList(
|
||||
LINE_TYPE_MAIN,
|
||||
LINE_TYPE_DISTRIBUTION
|
||||
));
|
||||
|
||||
public static final Set<BigDecimal> VOL_GRADES = new LinkedHashSet<BigDecimal>(Arrays.asList(
|
||||
new BigDecimal("0.38"),
|
||||
new BigDecimal("10"),
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.njcn.gather.tool.addledger.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 设备单位保存参数。
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("设备单位保存参数")
|
||||
public class AddDeviceUnitSaveParam {
|
||||
|
||||
@ApiModelProperty(value = "设备ID", required = true)
|
||||
@NotBlank(message = "设备 ID 不能为空")
|
||||
private String devId;
|
||||
|
||||
@ApiModelProperty("频率")
|
||||
private String unitFrequency;
|
||||
|
||||
@ApiModelProperty("频率偏差")
|
||||
private String unitFrequencyDev;
|
||||
|
||||
@ApiModelProperty("相电压有效值")
|
||||
private String phaseVoltage;
|
||||
|
||||
@ApiModelProperty("线电压有效值")
|
||||
private String lineVoltage;
|
||||
|
||||
@ApiModelProperty("电压上偏差")
|
||||
private String voltageDev;
|
||||
|
||||
@ApiModelProperty("电压下偏差")
|
||||
private String uvoltageDev;
|
||||
|
||||
@ApiModelProperty("电流有效值")
|
||||
private String ieffective;
|
||||
|
||||
@ApiModelProperty("单相有功功率")
|
||||
private String singleP;
|
||||
|
||||
@ApiModelProperty("单相视在功率")
|
||||
private String singleViewP;
|
||||
|
||||
@ApiModelProperty("单相无功功率")
|
||||
private String singleNoP;
|
||||
|
||||
@ApiModelProperty("总有功功率")
|
||||
private String totalActiveP;
|
||||
|
||||
@ApiModelProperty("总视在功率")
|
||||
private String totalViewP;
|
||||
|
||||
@ApiModelProperty("总无功功率")
|
||||
private String totalNoP;
|
||||
|
||||
@ApiModelProperty("相线电压基波有效值")
|
||||
private String vfundEffective;
|
||||
|
||||
@ApiModelProperty("基波电流")
|
||||
private String ifund;
|
||||
|
||||
@ApiModelProperty("基波有功功率")
|
||||
private String fundActiveP;
|
||||
|
||||
@ApiModelProperty("基波无功功率")
|
||||
private String fundNoP;
|
||||
|
||||
@ApiModelProperty("电压总谐波畸变率")
|
||||
private String vdistortion;
|
||||
|
||||
@ApiModelProperty("2-50次谐波电压含有率")
|
||||
private String vharmonicRate;
|
||||
|
||||
@ApiModelProperty("2-50次谐波电流有效值")
|
||||
private String iharmonic;
|
||||
|
||||
@ApiModelProperty("2-50次谐波有功功率")
|
||||
private String pharmonic;
|
||||
|
||||
@ApiModelProperty("0.5-49.5次间谐波电流有效值")
|
||||
private String iiharmonic;
|
||||
|
||||
@ApiModelProperty("正序电压")
|
||||
private String positiveV;
|
||||
|
||||
@ApiModelProperty("零序负序电压")
|
||||
private String noPositiveV;
|
||||
}
|
||||
@@ -81,6 +81,9 @@ public class AddLedgerLineSaveParam {
|
||||
@DecimalMin(value = "0", inclusive = true, message = "protocol_capacity 不能为负数")
|
||||
private BigDecimal protocolCapacity;
|
||||
|
||||
@ApiModelProperty("线路类型:0 主网,1 配网")
|
||||
private Integer lineType;
|
||||
|
||||
@ApiModelProperty("监测对象类型")
|
||||
private String monitorObj;
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.njcn.gather.tool.addledger.pojo.po;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据单位管理表。
|
||||
*/
|
||||
@Data
|
||||
@TableName("cs_device_unit")
|
||||
public class AddDeviceUnit {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "dev_id")
|
||||
@ApiModelProperty(value = "终端id")
|
||||
private String devId;
|
||||
|
||||
@TableField("unit_frequency")
|
||||
@ApiModelProperty(value = "频率")
|
||||
private String unitFrequency = "Hz";
|
||||
|
||||
@TableField("unit_frequency_dev")
|
||||
@ApiModelProperty(value = "频率偏差")
|
||||
private String unitFrequencyDev = "Hz";
|
||||
|
||||
@TableField("phase_voltage")
|
||||
@ApiModelProperty(value = "相电压有效值")
|
||||
private String phaseVoltage = "kV";
|
||||
|
||||
@TableField("line_voltage")
|
||||
@ApiModelProperty(value = "线电压有效值")
|
||||
private String lineVoltage = "kV";
|
||||
|
||||
@TableField("voltage_dev")
|
||||
@ApiModelProperty(value = "电压上偏差")
|
||||
private String voltageDev = "%";
|
||||
|
||||
@TableField("uvoltage_dev")
|
||||
@ApiModelProperty(value = "电压下偏差")
|
||||
private String uvoltageDev = "%";
|
||||
|
||||
@TableField("i_effective")
|
||||
@ApiModelProperty(value = "电流有效值")
|
||||
private String ieffective = "A";
|
||||
|
||||
@TableField("single_p")
|
||||
@ApiModelProperty(value = "单相有功功率")
|
||||
private String singleP = "kW";
|
||||
|
||||
@TableField("single_view_p")
|
||||
@ApiModelProperty(value = "单相视在功率")
|
||||
private String singleViewP = "kVA";
|
||||
|
||||
@TableField("single_no_p")
|
||||
@ApiModelProperty(value = "单相无功功率")
|
||||
private String singleNoP = "kVar";
|
||||
|
||||
@TableField("total_active_p")
|
||||
@ApiModelProperty(value = "总有功功率")
|
||||
private String totalActiveP = "kW";
|
||||
|
||||
@TableField("total_view_p")
|
||||
@ApiModelProperty(value = "总视在功率")
|
||||
private String totalViewP = "kVA";
|
||||
|
||||
@TableField("total_no_p")
|
||||
@ApiModelProperty(value = "总无功功率")
|
||||
private String totalNoP = "kVar";
|
||||
|
||||
@TableField("v_fund_effective")
|
||||
@ApiModelProperty(value = "相(线)电压基波有效值")
|
||||
private String vfundEffective = "kV";
|
||||
|
||||
@TableField("i_fund")
|
||||
@ApiModelProperty(value = "基波电流")
|
||||
private String ifund = "A";
|
||||
|
||||
@TableField("fund_active_p")
|
||||
@ApiModelProperty(value = "基波有功功率")
|
||||
private String fundActiveP = "kW";
|
||||
|
||||
@TableField("fund_no_p")
|
||||
@ApiModelProperty(value = "基波无功功率")
|
||||
private String fundNoP = "kVar";
|
||||
|
||||
@TableField("v_distortion")
|
||||
@ApiModelProperty(value = "电压总谐波畸变率")
|
||||
private String vdistortion = "%";
|
||||
|
||||
@TableField("v_harmonic_rate")
|
||||
@ApiModelProperty(value = "2~50次谐波电压含有率")
|
||||
private String vharmonicRate = "%";
|
||||
|
||||
@TableField("i_harmonic")
|
||||
@ApiModelProperty(value = "2~50次谐波电流有效值")
|
||||
private String iharmonic = "A";
|
||||
|
||||
@TableField("p_harmonic")
|
||||
@ApiModelProperty(value = "2~50次谐波有功功率")
|
||||
private String pharmonic = "kW";
|
||||
|
||||
@TableField("i_iharmonic")
|
||||
@ApiModelProperty(value = "0.5~49.5次间谐波电流有效值")
|
||||
private String iiharmonic = "A";
|
||||
|
||||
@TableField("positive_v")
|
||||
@ApiModelProperty(value = "正序电压")
|
||||
private String positiveV = "kV";
|
||||
|
||||
@TableField("no_positive_v")
|
||||
@ApiModelProperty(value = "零序负序电压")
|
||||
private String noPositiveV = "V";
|
||||
}
|
||||
@@ -64,6 +64,12 @@ public class AddLedgerLinePO extends BaseEntity {
|
||||
|
||||
private BigDecimal protocolCapacity;
|
||||
|
||||
/**
|
||||
* 线路类型:0 主网,1 配网。
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer lineType;
|
||||
|
||||
private String monitorObj;
|
||||
|
||||
private Integer isGovern;
|
||||
|
||||
@@ -0,0 +1,869 @@
|
||||
package com.njcn.gather.tool.addledger.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 越限阈值配置表。
|
||||
*/
|
||||
@Data
|
||||
@TableName("cs_overlimit")
|
||||
public class AddOverlimitPO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 监测点序号
|
||||
*/
|
||||
@TableId("line_id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 频率限值
|
||||
*/
|
||||
private Float freqDev;
|
||||
|
||||
/**
|
||||
* 电压波动
|
||||
*/
|
||||
private Float voltageFluctuation;
|
||||
|
||||
/**
|
||||
* 电压上偏差限值
|
||||
*/
|
||||
private Float voltageDev;
|
||||
|
||||
/**
|
||||
* 电压下偏差限值
|
||||
*/
|
||||
private Float uvoltageDev;
|
||||
|
||||
/**
|
||||
* 三相电压不平衡度限值
|
||||
*/
|
||||
private Float ubalance;
|
||||
|
||||
/**
|
||||
* 短时电压不平衡度限值
|
||||
*/
|
||||
private Float shortUbalance;
|
||||
|
||||
/**
|
||||
* 闪变限值
|
||||
*/
|
||||
private Float flicker;
|
||||
|
||||
/**
|
||||
* 电压总谐波畸变率限值
|
||||
*/
|
||||
private Float uaberrance;
|
||||
|
||||
/**
|
||||
* 负序电流限值
|
||||
*/
|
||||
private Float iNeg;
|
||||
|
||||
/**
|
||||
* 2次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_2")
|
||||
private Float uharm2;
|
||||
|
||||
/**
|
||||
* 3次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_3")
|
||||
private Float uharm3;
|
||||
|
||||
/**
|
||||
* 4次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_4")
|
||||
private Float uharm4;
|
||||
|
||||
/**
|
||||
* 5次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_5")
|
||||
private Float uharm5;
|
||||
|
||||
/**
|
||||
* 6次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_6")
|
||||
private Float uharm6;
|
||||
|
||||
/**
|
||||
* 7次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_7")
|
||||
private Float uharm7;
|
||||
|
||||
/**
|
||||
* 8次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_8")
|
||||
private Float uharm8;
|
||||
|
||||
/**
|
||||
* 9次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_9")
|
||||
private Float uharm9;
|
||||
|
||||
/**
|
||||
* 10次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_10")
|
||||
private Float uharm10;
|
||||
|
||||
/**
|
||||
* 11次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_11")
|
||||
private Float uharm11;
|
||||
|
||||
/**
|
||||
* 12次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_12")
|
||||
private Float uharm12;
|
||||
|
||||
/**
|
||||
* 13次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_13")
|
||||
private Float uharm13;
|
||||
|
||||
/**
|
||||
* 14次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_14")
|
||||
private Float uharm14;
|
||||
|
||||
/**
|
||||
* 15次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_15")
|
||||
private Float uharm15;
|
||||
|
||||
/**
|
||||
* 16次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_16")
|
||||
private Float uharm16;
|
||||
|
||||
/**
|
||||
* 17次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_17")
|
||||
private Float uharm17;
|
||||
|
||||
/**
|
||||
* 18次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_18")
|
||||
private Float uharm18;
|
||||
|
||||
/**
|
||||
* 19次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_19")
|
||||
private Float uharm19;
|
||||
|
||||
/**
|
||||
* 20次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_20")
|
||||
private Float uharm20;
|
||||
|
||||
/**
|
||||
* 21次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_21")
|
||||
private Float uharm21;
|
||||
|
||||
/**
|
||||
* 22次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_22")
|
||||
private Float uharm22;
|
||||
|
||||
/**
|
||||
* 23次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_23")
|
||||
private Float uharm23;
|
||||
|
||||
/**
|
||||
* 24次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_24")
|
||||
private Float uharm24;
|
||||
|
||||
/**
|
||||
* 25次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_25")
|
||||
private Float uharm25;
|
||||
|
||||
/**
|
||||
* 2次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_26")
|
||||
private Float uharm26;
|
||||
|
||||
/**
|
||||
* 3次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_27")
|
||||
private Float uharm27;
|
||||
|
||||
/**
|
||||
* 4次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_28")
|
||||
private Float uharm28;
|
||||
|
||||
/**
|
||||
* 5次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_29")
|
||||
private Float uharm29;
|
||||
|
||||
/**
|
||||
* 6次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_30")
|
||||
private Float uharm30;
|
||||
|
||||
/**
|
||||
* 7次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_31")
|
||||
private Float uharm31;
|
||||
|
||||
/**
|
||||
* 8次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_32")
|
||||
private Float uharm32;
|
||||
|
||||
/**
|
||||
* 9次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_33")
|
||||
private Float uharm33;
|
||||
|
||||
/**
|
||||
* 10次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_34")
|
||||
private Float uharm34;
|
||||
|
||||
/**
|
||||
* 11次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_35")
|
||||
private Float uharm35;
|
||||
|
||||
/**
|
||||
* 12次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_36")
|
||||
private Float uharm36;
|
||||
|
||||
/**
|
||||
* 13次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_37")
|
||||
private Float uharm37;
|
||||
|
||||
/**
|
||||
* 14次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_38")
|
||||
private Float uharm38;
|
||||
|
||||
/**
|
||||
* 15次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_39")
|
||||
private Float uharm39;
|
||||
|
||||
/**
|
||||
* 16次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_40")
|
||||
private Float uharm40;
|
||||
|
||||
/**
|
||||
* 17次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_41")
|
||||
private Float uharm41;
|
||||
|
||||
/**
|
||||
* 18次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_42")
|
||||
private Float uharm42;
|
||||
|
||||
/**
|
||||
* 19次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_43")
|
||||
private Float uharm43;
|
||||
|
||||
/**
|
||||
* 20次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_44")
|
||||
private Float uharm44;
|
||||
|
||||
/**
|
||||
* 21次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_45")
|
||||
private Float uharm45;
|
||||
|
||||
/**
|
||||
* 22次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_46")
|
||||
private Float uharm46;
|
||||
|
||||
/**
|
||||
* 23次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_47")
|
||||
private Float uharm47;
|
||||
|
||||
/**
|
||||
* 24次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_48")
|
||||
private Float uharm48;
|
||||
|
||||
/**
|
||||
* 25次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_49")
|
||||
private Float uharm49;
|
||||
|
||||
/**
|
||||
* 50次谐波电压限值
|
||||
*/
|
||||
@TableField("uharm_50")
|
||||
private Float uharm50;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 2次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_2")
|
||||
private Float iharm2;
|
||||
|
||||
/**
|
||||
* 3次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_3")
|
||||
private Float iharm3;
|
||||
|
||||
/**
|
||||
* 4次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_4")
|
||||
private Float iharm4;
|
||||
|
||||
/**
|
||||
* 5次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_5")
|
||||
private Float iharm5;
|
||||
|
||||
/**
|
||||
* 6次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_6")
|
||||
private Float iharm6;
|
||||
|
||||
/**
|
||||
* 7次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_7")
|
||||
private Float iharm7;
|
||||
|
||||
/**
|
||||
* 8次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_8")
|
||||
private Float iharm8;
|
||||
|
||||
/**
|
||||
* 9次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_9")
|
||||
private Float iharm9;
|
||||
|
||||
/**
|
||||
* 10次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_10")
|
||||
private Float iharm10;
|
||||
|
||||
/**
|
||||
* 11次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_11")
|
||||
private Float iharm11;
|
||||
|
||||
/**
|
||||
* 12次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_12")
|
||||
private Float iharm12;
|
||||
|
||||
/**
|
||||
* 13次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_13")
|
||||
private Float iharm13;
|
||||
|
||||
/**
|
||||
* 14次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_14")
|
||||
private Float iharm14;
|
||||
|
||||
/**
|
||||
* 15次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_15")
|
||||
private Float iharm15;
|
||||
|
||||
/**
|
||||
* 16次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_16")
|
||||
private Float iharm16;
|
||||
|
||||
/**
|
||||
* 17次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_17")
|
||||
private Float iharm17;
|
||||
|
||||
/**
|
||||
* 18次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_18")
|
||||
private Float iharm18;
|
||||
|
||||
/**
|
||||
* 19次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_19")
|
||||
private Float iharm19;
|
||||
|
||||
/**
|
||||
* 20次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_20")
|
||||
private Float iharm20;
|
||||
|
||||
/**
|
||||
* 21次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_21")
|
||||
private Float iharm21;
|
||||
|
||||
/**
|
||||
* 22次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_22")
|
||||
private Float iharm22;
|
||||
|
||||
/**
|
||||
* 23次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_23")
|
||||
private Float iharm23;
|
||||
|
||||
/**
|
||||
* 24次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_24")
|
||||
private Float iharm24;
|
||||
|
||||
/**
|
||||
* 25次谐波电流限值
|
||||
*/
|
||||
@TableField("iharm_25")
|
||||
private Float iharm25;
|
||||
|
||||
/**
|
||||
* 2次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_26")
|
||||
private Float iharm26;
|
||||
|
||||
/**
|
||||
* 3次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_27")
|
||||
private Float iharm27;
|
||||
|
||||
/**
|
||||
* 4次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_28")
|
||||
private Float iharm28;
|
||||
|
||||
/**
|
||||
* 5次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_29")
|
||||
private Float iharm29;
|
||||
|
||||
/**
|
||||
* 6次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_30")
|
||||
private Float iharm30;
|
||||
|
||||
/**
|
||||
* 7次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_31")
|
||||
private Float iharm31;
|
||||
|
||||
/**
|
||||
* 8次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_32")
|
||||
private Float iharm32;
|
||||
|
||||
/**
|
||||
* 9次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_33")
|
||||
private Float iharm33;
|
||||
|
||||
/**
|
||||
* 10次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_34")
|
||||
private Float iharm34;
|
||||
|
||||
/**
|
||||
* 11次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_35")
|
||||
private Float iharm35;
|
||||
|
||||
/**
|
||||
* 12次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_36")
|
||||
private Float iharm36;
|
||||
|
||||
/**
|
||||
* 13次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_37")
|
||||
private Float iharm37;
|
||||
|
||||
/**
|
||||
* 14次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_38")
|
||||
private Float iharm38;
|
||||
|
||||
/**
|
||||
* 15次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_39")
|
||||
private Float iharm39;
|
||||
|
||||
/**
|
||||
* 16次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_40")
|
||||
private Float iharm40;
|
||||
|
||||
/**
|
||||
* 17次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_41")
|
||||
private Float iharm41;
|
||||
|
||||
/**
|
||||
* 18次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_42")
|
||||
private Float iharm42;
|
||||
|
||||
/**
|
||||
* 19次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_43")
|
||||
private Float iharm43;
|
||||
|
||||
/**
|
||||
* 20次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_44")
|
||||
private Float iharm44;
|
||||
|
||||
/**
|
||||
* 21次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_45")
|
||||
private Float iharm45;
|
||||
|
||||
/**
|
||||
* 22次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_46")
|
||||
private Float iharm46;
|
||||
|
||||
/**
|
||||
* 23次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_47")
|
||||
private Float iharm47;
|
||||
|
||||
/**
|
||||
* 24次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_48")
|
||||
private Float iharm48;
|
||||
|
||||
/**
|
||||
* 25次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_49")
|
||||
private Float iharm49;
|
||||
|
||||
/**
|
||||
* 50次谐波电压限值
|
||||
*/
|
||||
@TableField("iharm_50")
|
||||
private Float iharm50;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 0.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_1")
|
||||
private Float inuharm1;
|
||||
|
||||
/**
|
||||
* 1.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_2")
|
||||
private Float inuharm2;
|
||||
|
||||
/**
|
||||
* 2.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_3")
|
||||
private Float inuharm3;
|
||||
|
||||
/**
|
||||
* 3.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_4")
|
||||
private Float inuharm4;
|
||||
|
||||
/**
|
||||
* 4.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_5")
|
||||
private Float inuharm5;
|
||||
|
||||
/**
|
||||
* 5.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_6")
|
||||
private Float inuharm6;
|
||||
|
||||
/**
|
||||
* 6.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_7")
|
||||
private Float inuharm7;
|
||||
|
||||
/**
|
||||
* 7.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_8")
|
||||
private Float inuharm8;
|
||||
|
||||
/**
|
||||
* 8.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_9")
|
||||
private Float inuharm9;
|
||||
|
||||
/**
|
||||
* 9.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_10")
|
||||
private Float inuharm10;
|
||||
|
||||
/**
|
||||
* 10.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_11")
|
||||
private Float inuharm11;
|
||||
|
||||
/**
|
||||
* 11.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_12")
|
||||
private Float inuharm12;
|
||||
|
||||
/**
|
||||
* 12.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_13")
|
||||
private Float inuharm13;
|
||||
|
||||
/**
|
||||
* 13.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_14")
|
||||
private Float inuharm14;
|
||||
|
||||
/**
|
||||
* 14.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_15")
|
||||
private Float inuharm15;
|
||||
|
||||
/**
|
||||
* 15.5次间谐波电压限值
|
||||
*/
|
||||
@TableField("inuharm_16")
|
||||
private Float inuharm16;
|
||||
|
||||
public AddOverlimitPO(){}
|
||||
|
||||
|
||||
|
||||
public void buildIHarm(Float[] iHarmTem){
|
||||
this.iharm2= iHarmTem[0];
|
||||
this.iharm4= iHarmTem[2];
|
||||
this.iharm6= iHarmTem[4];
|
||||
this.iharm8= iHarmTem[6];
|
||||
this.iharm10= iHarmTem[8];
|
||||
this.iharm12= iHarmTem[10];
|
||||
this.iharm14= iHarmTem[12];
|
||||
this.iharm16= iHarmTem[14];
|
||||
this.iharm18= iHarmTem[16];
|
||||
this.iharm20= iHarmTem[18];
|
||||
this.iharm22= iHarmTem[20];
|
||||
this.iharm24= iHarmTem[22];
|
||||
this.iharm26= iHarmTem[24];
|
||||
this.iharm28= iHarmTem[26];
|
||||
this.iharm30= iHarmTem[28];
|
||||
this.iharm32= iHarmTem[30];
|
||||
this.iharm34= iHarmTem[32];
|
||||
this.iharm36= iHarmTem[34];
|
||||
this.iharm38= iHarmTem[36];
|
||||
this.iharm40= iHarmTem[38];
|
||||
this.iharm42= iHarmTem[40];
|
||||
this.iharm44= iHarmTem[42];
|
||||
this.iharm46= iHarmTem[44];
|
||||
this.iharm48= iHarmTem[46];
|
||||
this.iharm50= iHarmTem[48];
|
||||
|
||||
|
||||
|
||||
this.iharm3= iHarmTem[1];
|
||||
this.iharm5= iHarmTem[3];
|
||||
this.iharm7= iHarmTem[5];
|
||||
this.iharm9= iHarmTem[7];
|
||||
this.iharm11= iHarmTem[9];
|
||||
this.iharm13= iHarmTem[11];
|
||||
this.iharm15= iHarmTem[13];
|
||||
this.iharm17= iHarmTem[15];
|
||||
this.iharm19= iHarmTem[17];
|
||||
this.iharm21= iHarmTem[19];
|
||||
this.iharm23= iHarmTem[21];
|
||||
this.iharm25= iHarmTem[23];
|
||||
this.iharm27= iHarmTem[25];
|
||||
this.iharm29= iHarmTem[27];
|
||||
this.iharm31= iHarmTem[29];
|
||||
this.iharm33= iHarmTem[31];
|
||||
this.iharm35= iHarmTem[33];
|
||||
this.iharm37= iHarmTem[35];
|
||||
this.iharm39= iHarmTem[37];
|
||||
this.iharm41= iHarmTem[39];
|
||||
this.iharm43= iHarmTem[41];
|
||||
this.iharm45= iHarmTem[43];
|
||||
this.iharm47= iHarmTem[45];
|
||||
this.iharm49= iHarmTem[47];
|
||||
}
|
||||
|
||||
public void buildUharm(Float resultEven,Float resultOdd){
|
||||
this.uharm2=resultEven;
|
||||
this.uharm4=resultEven;
|
||||
this.uharm6=resultEven;
|
||||
this.uharm8=resultEven;
|
||||
this.uharm10=resultEven;
|
||||
this.uharm12=resultEven;
|
||||
this.uharm14=resultEven;
|
||||
this.uharm16=resultEven;
|
||||
this.uharm18=resultEven;
|
||||
this.uharm20=resultEven;
|
||||
this.uharm22=resultEven;
|
||||
this.uharm24=resultEven;
|
||||
this.uharm26=resultEven;
|
||||
this.uharm28=resultEven;
|
||||
this.uharm30=resultEven;
|
||||
this.uharm32=resultEven;
|
||||
this.uharm34=resultEven;
|
||||
this.uharm36=resultEven;
|
||||
this.uharm38=resultEven;
|
||||
this.uharm40=resultEven;
|
||||
this.uharm42=resultEven;
|
||||
this.uharm44=resultEven;
|
||||
this.uharm46=resultEven;
|
||||
this.uharm48=resultEven;
|
||||
this.uharm50=resultEven;
|
||||
|
||||
|
||||
this.uharm3=resultOdd;
|
||||
this.uharm5=resultOdd;
|
||||
this.uharm7=resultOdd;
|
||||
this.uharm9=resultOdd;
|
||||
this.uharm11=resultOdd;
|
||||
this.uharm13=resultOdd;
|
||||
this.uharm15=resultOdd;
|
||||
this.uharm17=resultOdd;
|
||||
this.uharm19=resultOdd;
|
||||
this.uharm21=resultOdd;
|
||||
this.uharm23=resultOdd;
|
||||
this.uharm25=resultOdd;
|
||||
this.uharm27=resultOdd;
|
||||
this.uharm29=resultOdd;
|
||||
this.uharm31=resultOdd;
|
||||
this.uharm33=resultOdd;
|
||||
this.uharm35=resultOdd;
|
||||
this.uharm37=resultOdd;
|
||||
this.uharm39=resultOdd;
|
||||
this.uharm41=resultOdd;
|
||||
this.uharm43=resultOdd;
|
||||
this.uharm45=resultOdd;
|
||||
this.uharm47=resultOdd;
|
||||
this.uharm49=resultOdd;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.njcn.gather.tool.addledger.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 设备单位配置。
|
||||
*/
|
||||
@Data
|
||||
public class AddDeviceUnitVO {
|
||||
|
||||
private String devId;
|
||||
|
||||
private String unitFrequency;
|
||||
|
||||
private String unitFrequencyDev;
|
||||
|
||||
private String phaseVoltage;
|
||||
|
||||
private String lineVoltage;
|
||||
|
||||
private String voltageDev;
|
||||
|
||||
private String uvoltageDev;
|
||||
|
||||
private String ieffective;
|
||||
|
||||
private String singleP;
|
||||
|
||||
private String singleViewP;
|
||||
|
||||
private String singleNoP;
|
||||
|
||||
private String totalActiveP;
|
||||
|
||||
private String totalViewP;
|
||||
|
||||
private String totalNoP;
|
||||
|
||||
private String vfundEffective;
|
||||
|
||||
private String ifund;
|
||||
|
||||
private String fundActiveP;
|
||||
|
||||
private String fundNoP;
|
||||
|
||||
private String vdistortion;
|
||||
|
||||
private String vharmonicRate;
|
||||
|
||||
private String iharmonic;
|
||||
|
||||
private String pharmonic;
|
||||
|
||||
private String iiharmonic;
|
||||
|
||||
private String positiveV;
|
||||
|
||||
private String noPositiveV;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.tool.addledger.pojo.vo;
|
||||
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddOverlimitPO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -70,6 +71,10 @@ public class AddLedgerDetailVO {
|
||||
|
||||
private BigDecimal protocolCapacity;
|
||||
|
||||
private Integer lineType;
|
||||
|
||||
private AddOverlimitPO overlimit;
|
||||
|
||||
private String monitorObj;
|
||||
|
||||
private Integer isGovern;
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.njcn.gather.tool.addledger.service;
|
||||
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddDeviceUnitSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerEngineeringSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerEquipmentSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerLinePathQueryParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerLineSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerProjectSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddOverlimitPO;
|
||||
import com.njcn.gather.tool.addledger.pojo.vo.AddDeviceUnitVO;
|
||||
import com.njcn.gather.tool.addledger.pojo.vo.AddLedgerDetailVO;
|
||||
import com.njcn.gather.tool.addledger.pojo.vo.AddLedgerLinePathVO;
|
||||
import com.njcn.gather.tool.addledger.pojo.vo.AddLedgerTreeNodeVO;
|
||||
@@ -27,8 +30,14 @@ public interface AddLedgerService {
|
||||
|
||||
AddLedgerDetailVO saveEquipment(AddLedgerEquipmentSaveParam param);
|
||||
|
||||
AddDeviceUnitVO getDeviceUnit(String devId);
|
||||
|
||||
AddDeviceUnitVO saveDeviceUnit(AddDeviceUnitSaveParam param);
|
||||
|
||||
AddLedgerDetailVO saveLine(AddLedgerLineSaveParam param);
|
||||
|
||||
AddOverlimitPO getLineOverlimit(String lineId);
|
||||
|
||||
List<Integer> availableLineNos(String deviceId, String lineId);
|
||||
|
||||
Map<String, AddLedgerLinePathVO> listLinePathByLineIds(List<String> lineIds);
|
||||
|
||||
@@ -7,23 +7,30 @@ import com.njcn.gather.tool.addledger.mapper.AddLedgerEquipmentMapper;
|
||||
import com.njcn.gather.tool.addledger.mapper.AddLedgerLedgerMapper;
|
||||
import com.njcn.gather.tool.addledger.mapper.AddLedgerLineMapper;
|
||||
import com.njcn.gather.tool.addledger.mapper.AddLedgerProjectMapper;
|
||||
import com.njcn.gather.tool.addledger.mapper.AddDeviceUnitMapper;
|
||||
import com.njcn.gather.tool.addledger.mapper.AddOverlimitMapper;
|
||||
import com.njcn.gather.tool.addledger.pojo.constant.AddLedgerConst;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddDeviceUnitSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerEngineeringSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerEquipmentSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerLinePathQueryParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerLineSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerProjectSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddDeviceUnit;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddLedgerEngineeringPO;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddLedgerEquipmentPO;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddLedgerLedgerPO;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddLedgerLinePO;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddLedgerProjectPO;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddOverlimitPO;
|
||||
import com.njcn.gather.tool.addledger.pojo.vo.AddDeviceUnitVO;
|
||||
import com.njcn.gather.tool.addledger.pojo.vo.AddLedgerDetailVO;
|
||||
import com.njcn.gather.tool.addledger.pojo.vo.AddLedgerLinePathVO;
|
||||
import com.njcn.gather.tool.addledger.pojo.vo.AddLedgerTreeNodeVO;
|
||||
import com.njcn.gather.tool.addledger.service.AddLedgerService;
|
||||
import com.njcn.gather.tool.addledger.util.AddLedgerIdUtil;
|
||||
import com.njcn.gather.tool.addledger.util.AddLedgerLineNoUtil;
|
||||
import com.njcn.gather.tool.addledger.util.COverlimitUtil;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -51,6 +58,8 @@ public class AddLedgerServiceImpl implements AddLedgerService {
|
||||
private final AddLedgerEquipmentMapper equipmentMapper;
|
||||
private final AddLedgerLineMapper lineMapper;
|
||||
private final AddLedgerLedgerMapper ledgerMapper;
|
||||
private final AddDeviceUnitMapper deviceUnitMapper;
|
||||
private final AddOverlimitMapper overlimitMapper;
|
||||
private final AddLedgerTreeBuilder treeBuilder;
|
||||
|
||||
@Override
|
||||
@@ -167,6 +176,7 @@ public class AddLedgerServiceImpl implements AddLedgerService {
|
||||
equipment.setUsageStatus(AddLedgerConst.ENABLE);
|
||||
equipment.setSort(0);
|
||||
equipmentMapper.insert(equipment);
|
||||
saveDefaultDeviceUnit(id);
|
||||
saveLedger(id, projectLedger.getId(), buildChildPids(projectLedger), equipment.getName(), AddLedgerConst.LEVEL_EQUIPMENT);
|
||||
} else {
|
||||
equipmentMapper.updateById(equipment);
|
||||
@@ -175,6 +185,39 @@ public class AddLedgerServiceImpl implements AddLedgerService {
|
||||
return detail(id, AddLedgerConst.LEVEL_EQUIPMENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddDeviceUnitVO getDeviceUnit(String devId) {
|
||||
String deviceId = requireText(devId, "设备 ID 不能为空");
|
||||
requireEquipment(deviceId);
|
||||
AddDeviceUnit unit = deviceUnitMapper.selectById(deviceId);
|
||||
if (unit == null) {
|
||||
unit = buildDefaultDeviceUnit(deviceId);
|
||||
}
|
||||
return buildDeviceUnitVO(unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AddDeviceUnitVO saveDeviceUnit(AddDeviceUnitSaveParam param) {
|
||||
if (param == null) {
|
||||
throw new IllegalArgumentException("设备单位参数不能为空");
|
||||
}
|
||||
String deviceId = requireText(param.getDevId(), "设备 ID 不能为空");
|
||||
requireEquipment(deviceId);
|
||||
AddDeviceUnit unit = deviceUnitMapper.selectById(deviceId);
|
||||
boolean create = unit == null;
|
||||
if (create) {
|
||||
unit = buildDefaultDeviceUnit(deviceId);
|
||||
}
|
||||
applyDeviceUnitParam(unit, param);
|
||||
if (create) {
|
||||
deviceUnitMapper.insert(unit);
|
||||
} else {
|
||||
deviceUnitMapper.updateById(unit);
|
||||
}
|
||||
return buildDeviceUnitVO(unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AddLedgerDetailVO saveLine(AddLedgerLineSaveParam param) {
|
||||
@@ -206,6 +249,7 @@ public class AddLedgerServiceImpl implements AddLedgerService {
|
||||
line.setDevCapacity(param.getDevCapacity());
|
||||
line.setBasicCapacity(param.getBasicCapacity());
|
||||
line.setProtocolCapacity(param.getProtocolCapacity());
|
||||
line.setLineType(param.getLineType() == null ? AddLedgerConst.LINE_TYPE_MAIN : param.getLineType());
|
||||
line.setMonitorObj(trimToNull(param.getMonitorObj()));
|
||||
line.setIsGovern(param.getIsGovern() == null ? AddLedgerConst.DISABLE : param.getIsGovern());
|
||||
line.setMonitorUser(trimToNull(param.getMonitorUser()));
|
||||
@@ -221,6 +265,7 @@ public class AddLedgerServiceImpl implements AddLedgerService {
|
||||
lineMapper.updateById(line);
|
||||
updateLedgerName(id, AddLedgerConst.LEVEL_LINE, line.getName());
|
||||
}
|
||||
saveOrUpdateOverlimit(line);
|
||||
return detail(id, AddLedgerConst.LEVEL_LINE);
|
||||
}
|
||||
|
||||
@@ -231,6 +276,12 @@ public class AddLedgerServiceImpl implements AddLedgerService {
|
||||
return AddLedgerLineNoUtil.resolveAvailableLineNos(usedLineNos, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddOverlimitPO getLineOverlimit(String lineId) {
|
||||
AddLedgerLinePO line = requireLine(lineId);
|
||||
return overlimitMapper.selectById(line.getLineId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, AddLedgerLinePathVO> listLinePathByLineIds(List<String> lineIds) {
|
||||
List<String> normalizedLineIds = normalizeIds(lineIds);
|
||||
@@ -296,6 +347,7 @@ public class AddLedgerServiceImpl implements AddLedgerService {
|
||||
String updateBy = currentUserId();
|
||||
if (!lineIds.isEmpty()) {
|
||||
lineMapper.softDeleteByIds(lineIds, updateBy);
|
||||
overlimitMapper.deleteBatchIds(lineIds);
|
||||
}
|
||||
if (!equipmentIds.isEmpty()) {
|
||||
equipmentMapper.softDeleteByIds(equipmentIds, updateBy);
|
||||
@@ -344,6 +396,9 @@ public class AddLedgerServiceImpl implements AddLedgerService {
|
||||
requireNonNegativeIfPresent(param.getDevCapacity(), "dev_capacity 不能为负数");
|
||||
requireNonNegativeIfPresent(param.getBasicCapacity(), "basic_capacity 不能为负数");
|
||||
requireNonNegativeIfPresent(param.getProtocolCapacity(), "protocol_capacity 不能为负数");
|
||||
if (param.getLineType() != null && !AddLedgerConst.LINE_TYPES.contains(param.getLineType())) {
|
||||
throw new IllegalArgumentException("lineType 只能是 0 或 1");
|
||||
}
|
||||
}
|
||||
|
||||
private void assertLineNoUnique(String deviceId, Integer lineNo, String lineId) {
|
||||
@@ -437,6 +492,16 @@ public class AddLedgerServiceImpl implements AddLedgerService {
|
||||
ledgerMapper.insert(ledger);
|
||||
}
|
||||
|
||||
private void saveDefaultDeviceUnit(String devId) {
|
||||
deviceUnitMapper.insert(buildDefaultDeviceUnit(devId));
|
||||
}
|
||||
|
||||
private AddDeviceUnit buildDefaultDeviceUnit(String devId) {
|
||||
AddDeviceUnit unit = new AddDeviceUnit();
|
||||
unit.setDevId(devId);
|
||||
return unit;
|
||||
}
|
||||
|
||||
private void updateLedgerName(String id, Integer level, String name) {
|
||||
AddLedgerLedgerPO ledger = requireLedger(id, level, levelName(level) + "节点");
|
||||
ledger.setName(name);
|
||||
@@ -493,6 +558,8 @@ public class AddLedgerServiceImpl implements AddLedgerService {
|
||||
detail.setDevCapacity(line.getDevCapacity());
|
||||
detail.setBasicCapacity(line.getBasicCapacity());
|
||||
detail.setProtocolCapacity(line.getProtocolCapacity());
|
||||
detail.setLineType(AddLedgerConst.LINE_TYPE_MAIN);
|
||||
detail.setOverlimit(overlimitMapper.selectById(line.getLineId()));
|
||||
detail.setMonitorObj(line.getMonitorObj());
|
||||
detail.setIsGovern(line.getIsGovern());
|
||||
detail.setMonitorUser(line.getMonitorUser());
|
||||
@@ -500,6 +567,83 @@ public class AddLedgerServiceImpl implements AddLedgerService {
|
||||
return detail;
|
||||
}
|
||||
|
||||
private void saveOrUpdateOverlimit(AddLedgerLinePO line) {
|
||||
AddOverlimitPO overlimit = COverlimitUtil.globalAssemble(
|
||||
toFloat(line.getVolGrade()),
|
||||
toFloat(line.getProtocolCapacity()),
|
||||
toFloat(line.getDevCapacity()),
|
||||
toFloat(line.getShortCircuitCapacity()),
|
||||
null,
|
||||
line.getLineType() == null ? AddLedgerConst.LINE_TYPE_MAIN : line.getLineType());
|
||||
overlimit.setId(line.getLineId());
|
||||
if (overlimitMapper.selectById(line.getLineId()) == null) {
|
||||
overlimitMapper.insert(overlimit);
|
||||
} else {
|
||||
overlimitMapper.updateById(overlimit);
|
||||
}
|
||||
}
|
||||
|
||||
private Float toFloat(BigDecimal value) {
|
||||
return value == null ? null : value.floatValue();
|
||||
}
|
||||
|
||||
private void applyDeviceUnitParam(AddDeviceUnit unit, AddDeviceUnitSaveParam param) {
|
||||
unit.setUnitFrequency(defaultIfBlank(param.getUnitFrequency(), unit.getUnitFrequency()));
|
||||
unit.setUnitFrequencyDev(defaultIfBlank(param.getUnitFrequencyDev(), unit.getUnitFrequencyDev()));
|
||||
unit.setPhaseVoltage(defaultIfBlank(param.getPhaseVoltage(), unit.getPhaseVoltage()));
|
||||
unit.setLineVoltage(defaultIfBlank(param.getLineVoltage(), unit.getLineVoltage()));
|
||||
unit.setVoltageDev(defaultIfBlank(param.getVoltageDev(), unit.getVoltageDev()));
|
||||
unit.setUvoltageDev(defaultIfBlank(param.getUvoltageDev(), unit.getUvoltageDev()));
|
||||
unit.setIeffective(defaultIfBlank(param.getIeffective(), unit.getIeffective()));
|
||||
unit.setSingleP(defaultIfBlank(param.getSingleP(), unit.getSingleP()));
|
||||
unit.setSingleViewP(defaultIfBlank(param.getSingleViewP(), unit.getSingleViewP()));
|
||||
unit.setSingleNoP(defaultIfBlank(param.getSingleNoP(), unit.getSingleNoP()));
|
||||
unit.setTotalActiveP(defaultIfBlank(param.getTotalActiveP(), unit.getTotalActiveP()));
|
||||
unit.setTotalViewP(defaultIfBlank(param.getTotalViewP(), unit.getTotalViewP()));
|
||||
unit.setTotalNoP(defaultIfBlank(param.getTotalNoP(), unit.getTotalNoP()));
|
||||
unit.setVfundEffective(defaultIfBlank(param.getVfundEffective(), unit.getVfundEffective()));
|
||||
unit.setIfund(defaultIfBlank(param.getIfund(), unit.getIfund()));
|
||||
unit.setFundActiveP(defaultIfBlank(param.getFundActiveP(), unit.getFundActiveP()));
|
||||
unit.setFundNoP(defaultIfBlank(param.getFundNoP(), unit.getFundNoP()));
|
||||
unit.setVdistortion(defaultIfBlank(param.getVdistortion(), unit.getVdistortion()));
|
||||
unit.setVharmonicRate(defaultIfBlank(param.getVharmonicRate(), unit.getVharmonicRate()));
|
||||
unit.setIharmonic(defaultIfBlank(param.getIharmonic(), unit.getIharmonic()));
|
||||
unit.setPharmonic(defaultIfBlank(param.getPharmonic(), unit.getPharmonic()));
|
||||
unit.setIiharmonic(defaultIfBlank(param.getIiharmonic(), unit.getIiharmonic()));
|
||||
unit.setPositiveV(defaultIfBlank(param.getPositiveV(), unit.getPositiveV()));
|
||||
unit.setNoPositiveV(defaultIfBlank(param.getNoPositiveV(), unit.getNoPositiveV()));
|
||||
}
|
||||
|
||||
private AddDeviceUnitVO buildDeviceUnitVO(AddDeviceUnit unit) {
|
||||
AddDeviceUnitVO vo = new AddDeviceUnitVO();
|
||||
vo.setDevId(unit.getDevId());
|
||||
vo.setUnitFrequency(unit.getUnitFrequency());
|
||||
vo.setUnitFrequencyDev(unit.getUnitFrequencyDev());
|
||||
vo.setPhaseVoltage(unit.getPhaseVoltage());
|
||||
vo.setLineVoltage(unit.getLineVoltage());
|
||||
vo.setVoltageDev(unit.getVoltageDev());
|
||||
vo.setUvoltageDev(unit.getUvoltageDev());
|
||||
vo.setIeffective(unit.getIeffective());
|
||||
vo.setSingleP(unit.getSingleP());
|
||||
vo.setSingleViewP(unit.getSingleViewP());
|
||||
vo.setSingleNoP(unit.getSingleNoP());
|
||||
vo.setTotalActiveP(unit.getTotalActiveP());
|
||||
vo.setTotalViewP(unit.getTotalViewP());
|
||||
vo.setTotalNoP(unit.getTotalNoP());
|
||||
vo.setVfundEffective(unit.getVfundEffective());
|
||||
vo.setIfund(unit.getIfund());
|
||||
vo.setFundActiveP(unit.getFundActiveP());
|
||||
vo.setFundNoP(unit.getFundNoP());
|
||||
vo.setVdistortion(unit.getVdistortion());
|
||||
vo.setVharmonicRate(unit.getVharmonicRate());
|
||||
vo.setIharmonic(unit.getIharmonic());
|
||||
vo.setPharmonic(unit.getPharmonic());
|
||||
vo.setIiharmonic(unit.getIiharmonic());
|
||||
vo.setPositiveV(unit.getPositiveV());
|
||||
vo.setNoPositiveV(unit.getNoPositiveV());
|
||||
return vo;
|
||||
}
|
||||
|
||||
private AddLedgerDetailVO buildBaseDetail(AddLedgerLedgerPO ledger) {
|
||||
AddLedgerDetailVO detail = new AddLedgerDetailVO();
|
||||
detail.setId(ledger.getId());
|
||||
@@ -551,6 +695,11 @@ public class AddLedgerServiceImpl implements AddLedgerService {
|
||||
return trimmed.isEmpty() ? null : trimmed;
|
||||
}
|
||||
|
||||
private String defaultIfBlank(String value, String defaultValue) {
|
||||
String text = trimToNull(value);
|
||||
return text == null ? defaultValue : text;
|
||||
}
|
||||
|
||||
private boolean isBlank(String value) {
|
||||
return trimToNull(value) == null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,414 @@
|
||||
package com.njcn.gather.tool.addledger.util;
|
||||
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddOverlimitPO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* 限值计算工具类
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/5/15
|
||||
*/
|
||||
public class COverlimitUtil {
|
||||
|
||||
private static final float DEFAULT_LIMIT = 3.14159f;
|
||||
private static final float DEFAULT_CURRENT_LIMIT = -3.14159f;
|
||||
private static final int LINE_TYPE_DISTRIBUTION = 1;
|
||||
|
||||
private static final float KV_0_22 = 0.22f;
|
||||
private static final float KV_0_6 = 0.6f;
|
||||
private static final float KV_1 = 1.0f;
|
||||
private static final float KV_6 = 6.0f;
|
||||
private static final float KV_10 = 10.0f;
|
||||
private static final float KV_20 = 20.0f;
|
||||
private static final float KV_35 = 35.0f;
|
||||
private static final float KV_66 = 66.0f;
|
||||
private static final float KV_110 = 110.0f;
|
||||
private static final float KV_220 = 220.0f;
|
||||
private static final float KV_330 = 330.0f;
|
||||
private static final float KV_500 = 500.0f;
|
||||
private static final float KV_750 = 750.0f;
|
||||
private static final float KV_1000 = 1000.0f;
|
||||
|
||||
|
||||
/**
|
||||
* 谐波电流系数
|
||||
*/
|
||||
private static final double[][] ARR = {
|
||||
{78, 62, 39, 62, 26, 44, 19, 21, 16, 28, 13, 24, 11, 12, 9.7, 18, 8.6, 16, 7.8, 8.9, 7.1, 14, 6.5, 12, 6.0, 6.9, 5.6, 11, 5.2, 10, 4.9, 5.6, 4.6, 8.9, 4.3, 8.4, 4.1, 4.8, 3.9, 7.6, 3.7, 7.2, 3.5, 4.1, 3.4, 6.6, 3.3, 6.3, 3.1},
|
||||
{43, 34, 21, 34, 14, 24, 11, 11, 8.5, 16, 7.1, 13, 6.1, 6.8, 5.3, 10, 4.7, 9, 4.3, 4.9, 3.9, 7.4, 3.6, 6.8, 3.3, 3.8, 3.1, 5.9, 2.9, 5.5, 2.7, 3.1, 2.5, 4.9, 2.4, 4.6, 2.3, 2.6, 2.2, 4.1, 2.0, 4.0, 2.0, 2.3, 1.9, 3.6, 1.8, 3.5, 1.7},
|
||||
{26, 20, 13, 20, 8.5, 15, 6.4, 6.8, 5.1, 9.3, 4.3, 7.9, 3.7, 4.1, 3.2, 6, 2.8, 5.4, 2.6, 2.9, 2.3, 4.5, 2.1, 4.1, 2.0, 2.2, 1.9, 3.4, 1.7, 3.2, 1.6, 1.8, 1.5, 2.9, 1.4, 2.7, 1.4, 1.5, 1.3, 2.4, 1.2, 2.3, 1.2, 1.3, 1.1, 2.1, 1.1, 2.0, 1.0},
|
||||
{15, 12, 7.7, 12, 5.1, 8.8, 3.8, 4.1, 3.1, 5.6, 2.6, 4.7, 2.2, 2.5, 1.9, 3.6, 1.7, 3.2, 1.5, 1.8, 1.4, 2.7, 1.3, 2.5, 1.2, 1.3, 1.1, 2.1, 1.0, 1.9, 0.9, 1.1, 0.9, 1.7, 0.8, 1.6, 0.8, 0.9, 0.8, 1.5, 0.7, 1.4, 0.7, 0.8, 0.7, 1.3, 0.6, 1.2, 0.6},
|
||||
{16, 13, 8.1, 13, 5.4, 9.3, 4.1, 4.3, 3.3, 5.9, 2.7, 5, 2.3, 2.6, 2, 3.8, 1.8, 3.4, 1.6, 1.9, 1.5, 2.8, 1.4, 2.6, 1.2, 1.4, 1.1, 2.2, 1.1, 2.1, 1.0, 1.2, 0.9, 1.9, 0.9, 1.8, 0.8, 1.0, 0.8, 1.6, 0.8, 1.5, 0.7, 0.9, 0.7, 1.4, 0.7, 1.3, 0.6},
|
||||
{12, 9.6, 6, 9.6, 4, 6.8, 3, 3.2, 2.4, 4.3, 2, 3.7, 1.7, 1.9, 1.5, 2.8, 1.3, 2.5, 1.2, 1.4, 1.1, 2.1, 1, 1.9, 0.9, 1.1, 0.9, 1.7, 0.8, 1.5, 0.8, 0.9, 0.7, 1.4, 0.7, 1.3, 0.6, 0.7, 0.6, 1.2, 0.6, 1.1, 0.5, 0.6, 0.5, 1.0, 0.5, 1.0, 0.5}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 计算监测点限值
|
||||
* @param voltageLevel 电压等级(10kV = 10 220kV = 220 )
|
||||
* @param protocolCapacity 协议容量
|
||||
* @param devCapacity 设备容量
|
||||
* @param shortCapacity 短路容量
|
||||
* @param powerFlag 0.用户侧 1.电网侧
|
||||
* @param lineType 0.主网 1.配网 需要注意配网目前没有四种容量,谐波电流幅值限值,负序电流限值无法计算默认-3.14159
|
||||
*/
|
||||
public static AddOverlimitPO globalAssemble(Float voltageLevel, Float protocolCapacity, Float devCapacity,
|
||||
Float shortCapacity, Integer powerFlag, Integer lineType) {
|
||||
if (voltageLevel == null) {
|
||||
throw new IllegalArgumentException("电压等级不能为空");
|
||||
}
|
||||
AddOverlimitPO overlimit = new AddOverlimitPO();
|
||||
voltageDeviation(overlimit,voltageLevel);
|
||||
frequency(overlimit);
|
||||
voltageFluctuation(overlimit,voltageLevel);
|
||||
voltageFlicker(overlimit,voltageLevel);
|
||||
totalHarmonicDistortion(overlimit,voltageLevel);
|
||||
uHarm(overlimit,voltageLevel);
|
||||
threeVoltageUnbalance(overlimit);
|
||||
interharmonicCurrent(overlimit,voltageLevel);
|
||||
|
||||
if(isDistributionLine(lineType)) {
|
||||
//配网
|
||||
Float[] iHarmTem = new Float[49];
|
||||
for (int i = 0; i <= 48; i++) {
|
||||
//目前只处理了配网II类测点,III类测点暂未处理,III类测点参考主网
|
||||
iHarmTem[i] = getHarmTag(i+2,voltageLevel).floatValue();
|
||||
}
|
||||
overlimit.buildIHarm(iHarmTem);
|
||||
overlimit.setINeg(DEFAULT_CURRENT_LIMIT);
|
||||
}else if (hasMainNetworkCapacity(protocolCapacity, devCapacity, shortCapacity)) {
|
||||
//主网
|
||||
iHarm(overlimit, voltageLevel, protocolCapacity, devCapacity, shortCapacity);
|
||||
negativeSequenceCurrent(overlimit, voltageLevel, shortCapacity);
|
||||
} else {
|
||||
setDefaultCurrentLimit(overlimit);
|
||||
}
|
||||
return overlimit;
|
||||
}
|
||||
|
||||
private static boolean isDistributionLine(Integer lineType) {
|
||||
return lineType != null && lineType == LINE_TYPE_DISTRIBUTION;
|
||||
}
|
||||
|
||||
private static boolean hasMainNetworkCapacity(Float protocolCapacity, Float devCapacity, Float shortCapacity) {
|
||||
return protocolCapacity != null && devCapacity != null && shortCapacity != null
|
||||
&& devCapacity > 0 && shortCapacity > 0;
|
||||
}
|
||||
|
||||
private static void setDefaultCurrentLimit(AddOverlimitPO overlimit) {
|
||||
Float[] iHarmTem = new Float[49];
|
||||
Arrays.fill(iHarmTem, DEFAULT_CURRENT_LIMIT);
|
||||
overlimit.buildIHarm(iHarmTem);
|
||||
overlimit.setINeg(DEFAULT_CURRENT_LIMIT);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 电压偏差限值
|
||||
*
|
||||
*/
|
||||
public static void voltageDeviation(AddOverlimitPO overlimit,Float voltageLevel) {
|
||||
float voltageDev = DEFAULT_LIMIT,uvoltageDev = DEFAULT_LIMIT;
|
||||
if(voltageLevel <= KV_0_22){
|
||||
voltageDev = 7.0f;
|
||||
uvoltageDev=-10.0f;
|
||||
}else if(voltageLevel>KV_0_22&&voltageLevel<KV_20){
|
||||
voltageDev = 7.0f;
|
||||
uvoltageDev=-7.0f;
|
||||
}else if(voltageLevel>=KV_20&&voltageLevel<KV_35){
|
||||
voltageDev = 7.0f;
|
||||
uvoltageDev=-7.0f;
|
||||
}else if(voltageLevel>=KV_35&&voltageLevel<KV_66){
|
||||
voltageDev = 10.0f;
|
||||
uvoltageDev=-10.0f;
|
||||
}else if(voltageLevel>=KV_66&&voltageLevel<=KV_110){
|
||||
voltageDev = 7.0f;
|
||||
uvoltageDev=-3.0f;
|
||||
}else if(voltageLevel>KV_110){
|
||||
voltageDev = 10.0f;
|
||||
uvoltageDev=-10.0f;
|
||||
}
|
||||
overlimit.setVoltageDev(voltageDev);
|
||||
overlimit.setUvoltageDev(uvoltageDev);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 频率偏差
|
||||
* 默认限值:±0.2Hz(即:-0.2 Hz≤限值≤0.2 Hz)
|
||||
*/
|
||||
public static void frequency(AddOverlimitPO overlimit) {
|
||||
overlimit.setFreqDev(0.2f);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 电压波动
|
||||
* 对LV、MV:0≤限值≤3%;对HV:0≤限值≤2.5%。
|
||||
* LV、MV、HV的定义:
|
||||
* 低压(LV) UN≤1kV
|
||||
* 中压(MV) 1kV<UN≤35kV
|
||||
* 高压(HV) 35kV<UN≤220kV
|
||||
* 超高压(EHV),220kV<UN,参照HV执行
|
||||
*/
|
||||
public static void voltageFluctuation(AddOverlimitPO overlimit, Float voltageLevel) {
|
||||
if (voltageLevel < KV_35) {
|
||||
overlimit.setVoltageFluctuation(3.0f);
|
||||
} else {
|
||||
overlimit.setVoltageFluctuation(2.5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 电压闪变
|
||||
* ≤110kV 1
|
||||
* >110kV 0.8
|
||||
*/
|
||||
public static void voltageFlicker(AddOverlimitPO overlimit, Float voltageLevel) {
|
||||
if (voltageLevel <= KV_110) {
|
||||
overlimit.setFlicker(1.0f);
|
||||
} else {
|
||||
overlimit.setFlicker(0.8f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 总谐波电压畸变率
|
||||
*
|
||||
*
|
||||
*/
|
||||
public static void totalHarmonicDistortion(AddOverlimitPO overlimit, Float voltageLevel) {
|
||||
float result = DEFAULT_LIMIT;
|
||||
if (voltageLevel < KV_6) {
|
||||
result = 5.0f;
|
||||
} else if(voltageLevel >= KV_6 && voltageLevel <= KV_20){
|
||||
result = 4.0f;
|
||||
} else if(voltageLevel >= KV_35 && voltageLevel <= KV_66){
|
||||
result = 3.0f;
|
||||
} else if(voltageLevel >= KV_110 && voltageLevel <= KV_1000){
|
||||
result = 2.0f;
|
||||
}
|
||||
overlimit.setUaberrance(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 谐波电压含有率
|
||||
*/
|
||||
public static void uHarm(AddOverlimitPO overlimit, Float voltageLevel) {
|
||||
float resultOdd = DEFAULT_LIMIT,resultEven = DEFAULT_LIMIT;
|
||||
if (voltageLevel < KV_6) {
|
||||
resultOdd = 4.0f;
|
||||
resultEven = 2.0f;
|
||||
} else if(voltageLevel >= KV_6 && voltageLevel <= KV_20){
|
||||
resultOdd = 3.2f;
|
||||
resultEven = 1.6f;
|
||||
} else if(voltageLevel >= KV_35 && voltageLevel <= KV_66){
|
||||
resultOdd = 2.4f;
|
||||
resultEven = 1.2f;
|
||||
} else if(voltageLevel >= KV_110 && voltageLevel <= KV_1000){
|
||||
resultOdd = 1.6f;
|
||||
resultEven = 0.8f;
|
||||
}
|
||||
overlimit.buildUharm(resultEven,resultOdd);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 负序电压不平衡(三相电压不平衡度)
|
||||
*
|
||||
*/
|
||||
public static void threeVoltageUnbalance(AddOverlimitPO overlimit) {
|
||||
overlimit.setUbalance(2.0f);
|
||||
overlimit.setShortUbalance(4.0f);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------谐波电流限值start-----------------------------------*/
|
||||
|
||||
/**
|
||||
* 谐波电流限值
|
||||
*/
|
||||
public static void iHarm(AddOverlimitPO overlimit, Float voltageLevel,Float protocolCapacity,Float devCapacity,Float shortCapacity) {
|
||||
float calCap = shortCapacity/getDlCapByVoltageLevel(voltageLevel);
|
||||
//24谐波电流幅值
|
||||
Float[] iHarmTem = new Float[49];
|
||||
for (int i = 0; i <= 48; i++) {
|
||||
float inHarm = iHarmCalculate(i+2,voltageLevel,protocolCapacity,devCapacity,calCap);
|
||||
iHarmTem[i] = inHarm;
|
||||
}
|
||||
overlimit.buildIHarm(iHarmTem);
|
||||
}
|
||||
/**
|
||||
* @Description: iHarmCalculate
|
||||
* @Param: protocolCapacity 协议容量 devCapacity设备容量 calCap 短路容量
|
||||
* @return: float
|
||||
* @Author: clam
|
||||
* @Date: 2024/2/4
|
||||
*/
|
||||
private static float iHarmCalculate(int nHarm, Float voltageLevel,float protocolCapacity, float devCapacity,float calCap) {
|
||||
double tag = calCap*getHarmTag(nHarm,voltageLevel);
|
||||
Double limit = getHarmonicLimit(nHarm,tag,new BigDecimal(String.valueOf(devCapacity)).doubleValue(),new BigDecimal(String.valueOf(protocolCapacity)).doubleValue());
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(limit).setScale(4,RoundingMode.HALF_UP);
|
||||
return bigDecimal.floatValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 电流谐波限值
|
||||
*/
|
||||
private static Double getHarmTag(Integer iCount, Float voltageLevel) {
|
||||
int x, y;
|
||||
if (voltageLevel < KV_6) {
|
||||
x = 0;
|
||||
} else if (voltageLevel<KV_10) {
|
||||
x = 1;
|
||||
} else if (voltageLevel<KV_35) {
|
||||
x = 2;
|
||||
} else if (voltageLevel<KV_66) {
|
||||
x = 3;
|
||||
} else if (voltageLevel<KV_110) {
|
||||
x = 4;
|
||||
} else {
|
||||
x = 5;
|
||||
}
|
||||
y = iCount - 2;
|
||||
return ARR[x][y];
|
||||
}
|
||||
|
||||
/**
|
||||
* 相位叠加系数的取值
|
||||
*/
|
||||
public static Double getHarmonicLimit(Integer times, double iTag, double supply, double user) {
|
||||
if (supply == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
double coefficient = 2.0;
|
||||
if (times == 3) {
|
||||
coefficient = 1.1;
|
||||
} else if (times == 5) {
|
||||
coefficient = 1.2;
|
||||
} else if (times == 7) {
|
||||
coefficient = 1.4;
|
||||
} else if (times == 11) {
|
||||
coefficient = 1.8;
|
||||
} else if (times == 13) {
|
||||
coefficient = 1.9;
|
||||
}
|
||||
BigDecimal bd = new BigDecimal(iTag * Math.pow((user / supply), (1 / coefficient)));
|
||||
bd = bd.setScale(6, RoundingMode.HALF_UP);
|
||||
return Double.parseDouble(bd.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据电压等级获取基准短路容量
|
||||
*/
|
||||
public static float getDlCapByVoltageLevel(Float voltageLevel){
|
||||
float capValue;
|
||||
if(voltageLevel< KV_0_6){
|
||||
capValue = 10;
|
||||
}else if(voltageLevel<KV_20){
|
||||
capValue = 100;
|
||||
}else if(voltageLevel<KV_35){
|
||||
capValue = 200;
|
||||
}else if(voltageLevel<KV_66){
|
||||
capValue = 250;
|
||||
}else if(voltageLevel<KV_110){
|
||||
capValue = 500;
|
||||
}else if(voltageLevel<KV_220){
|
||||
capValue = 750;
|
||||
}else if(voltageLevel<KV_330){
|
||||
capValue = 2000;
|
||||
}else if(voltageLevel<KV_500){
|
||||
capValue = 3000;
|
||||
}else if(voltageLevel<KV_750){
|
||||
capValue = 4500;
|
||||
}else if(voltageLevel<KV_1000){
|
||||
capValue = 7000;
|
||||
}else {
|
||||
capValue = 9000;
|
||||
}
|
||||
return capValue;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------谐波电流限值end-----------------------------------*/
|
||||
|
||||
|
||||
/**
|
||||
* 间谐波电压含有率
|
||||
*/
|
||||
|
||||
public static void interharmonicCurrent(AddOverlimitPO overlimit,Float voltageLevel){
|
||||
float aValue,bValue;
|
||||
if(voltageLevel <= KV_1){
|
||||
aValue = 0.2f;bValue = 0.5f;
|
||||
}else {
|
||||
aValue = 0.16f;bValue = 0.4f;
|
||||
}
|
||||
overlimit.setInuharm1(aValue);
|
||||
overlimit.setInuharm2(aValue);
|
||||
|
||||
overlimit.setInuharm3(bValue);
|
||||
overlimit.setInuharm4(bValue);
|
||||
overlimit.setInuharm5(bValue);
|
||||
overlimit.setInuharm6(bValue);
|
||||
overlimit.setInuharm7(bValue);
|
||||
overlimit.setInuharm8(bValue);
|
||||
overlimit.setInuharm9(bValue);
|
||||
overlimit.setInuharm10(bValue);
|
||||
overlimit.setInuharm11(bValue);
|
||||
overlimit.setInuharm12(bValue);
|
||||
overlimit.setInuharm13(bValue);
|
||||
overlimit.setInuharm14(bValue);
|
||||
overlimit.setInuharm15(bValue);
|
||||
overlimit.setInuharm16(bValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 负序电流限值
|
||||
*/
|
||||
public static void negativeSequenceCurrent(AddOverlimitPO overlimit,Float voltageLevel,Float shortCapacity){
|
||||
double v = (0.013*shortCapacity*1000)/(getUl(voltageLevel)*Math.sqrt(3));
|
||||
overlimit.setINeg((float) v);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取额定线电压
|
||||
*/
|
||||
private static float getUl(Float voltageLevel){
|
||||
float value;
|
||||
if(voltageLevel<KV_6){
|
||||
value = 0.4f;
|
||||
}else if(voltageLevel<KV_10){
|
||||
value = 6.3f;
|
||||
}else if(voltageLevel<KV_20){
|
||||
value = 10.5f;
|
||||
}else if(voltageLevel<KV_35){
|
||||
value = 21.0f;
|
||||
}else if(voltageLevel<KV_66){
|
||||
value = 36.5f;
|
||||
}else if(voltageLevel<KV_110){
|
||||
value = 69.0f;
|
||||
}else if(voltageLevel<KV_220){
|
||||
value = 115.5f;
|
||||
}else if(voltageLevel<KV_330){
|
||||
value = 230.0f;
|
||||
}else {
|
||||
value = 345.0f;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,15 +6,28 @@ import com.njcn.gather.tool.addledger.mapper.AddLedgerEquipmentMapper;
|
||||
import com.njcn.gather.tool.addledger.mapper.AddLedgerLedgerMapper;
|
||||
import com.njcn.gather.tool.addledger.mapper.AddLedgerLineMapper;
|
||||
import com.njcn.gather.tool.addledger.mapper.AddLedgerProjectMapper;
|
||||
import com.njcn.gather.tool.addledger.mapper.AddDeviceUnitMapper;
|
||||
import com.njcn.gather.tool.addledger.mapper.AddOverlimitMapper;
|
||||
import com.njcn.gather.tool.addledger.pojo.constant.AddLedgerConst;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddDeviceUnitSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerEquipmentSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.param.AddLedgerLineSaveParam;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddDeviceUnit;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddLedgerEquipmentPO;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddLedgerLedgerPO;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddLedgerLinePO;
|
||||
import com.njcn.gather.tool.addledger.pojo.po.AddOverlimitPO;
|
||||
import com.njcn.gather.tool.addledger.pojo.vo.AddDeviceUnitVO;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
class AddLedgerServiceImplTest {
|
||||
@@ -24,6 +37,8 @@ class AddLedgerServiceImplTest {
|
||||
private final AddLedgerEquipmentMapper equipmentMapper = mock(AddLedgerEquipmentMapper.class);
|
||||
private final AddLedgerLineMapper lineMapper = mock(AddLedgerLineMapper.class);
|
||||
private final AddLedgerLedgerMapper ledgerMapper = mock(AddLedgerLedgerMapper.class);
|
||||
private final AddDeviceUnitMapper deviceUnitMapper = mock(AddDeviceUnitMapper.class);
|
||||
private final AddOverlimitMapper overlimitMapper = mock(AddOverlimitMapper.class);
|
||||
private final AddLedgerTreeBuilder treeBuilder = mock(AddLedgerTreeBuilder.class);
|
||||
|
||||
private final AddLedgerServiceImpl service = new AddLedgerServiceImpl(
|
||||
@@ -32,6 +47,8 @@ class AddLedgerServiceImplTest {
|
||||
equipmentMapper,
|
||||
lineMapper,
|
||||
ledgerMapper,
|
||||
deviceUnitMapper,
|
||||
overlimitMapper,
|
||||
treeBuilder);
|
||||
|
||||
@Test
|
||||
@@ -50,6 +67,65 @@ class AddLedgerServiceImplTest {
|
||||
+ "。如果是新增监测点,请不要传 lineId;如果是编辑监测点,请传已存在的测点 ID", exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void saveEquipmentShouldCreateDefaultDeviceUnitWhenCreatingEquipment() {
|
||||
AddLedgerEquipmentSaveParam param = buildValidEquipmentParam();
|
||||
AddLedgerLedgerPO projectLedger = buildLedger("project-001", "engineering-001",
|
||||
AddLedgerConst.ROOT_PARENT_ID + ",engineering-001", AddLedgerConst.LEVEL_PROJECT);
|
||||
AddLedgerLedgerPO engineeringLedger = buildLedger("engineering-001", AddLedgerConst.ROOT_PARENT_ID,
|
||||
AddLedgerConst.ROOT_PARENT_ID, AddLedgerConst.LEVEL_ENGINEERING);
|
||||
|
||||
when(ledgerMapper.selectActiveNode(eq("project-001"), eq(AddLedgerConst.LEVEL_PROJECT))).thenReturn(projectLedger);
|
||||
when(ledgerMapper.selectActiveNode(eq("engineering-001"), eq(AddLedgerConst.LEVEL_ENGINEERING))).thenReturn(engineeringLedger);
|
||||
when(ledgerMapper.selectActiveNode(any(String.class), eq(AddLedgerConst.LEVEL_EQUIPMENT)))
|
||||
.thenAnswer(invocation -> buildLedger(invocation.getArgument(0), "project-001",
|
||||
AddLedgerConst.ROOT_PARENT_ID + ",engineering-001,project-001", AddLedgerConst.LEVEL_EQUIPMENT));
|
||||
when(equipmentMapper.selectOne(any())).thenReturn(buildActiveEquipment("device-001"));
|
||||
|
||||
service.saveEquipment(param);
|
||||
|
||||
ArgumentCaptor<AddDeviceUnit> captor = ArgumentCaptor.forClass(AddDeviceUnit.class);
|
||||
verify(deviceUnitMapper).insert(captor.capture());
|
||||
Assertions.assertNotNull(captor.getValue().getDevId());
|
||||
Assertions.assertEquals("Hz", captor.getValue().getUnitFrequency());
|
||||
Assertions.assertEquals("kV", captor.getValue().getPhaseVoltage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void saveDeviceUnitShouldUpdateExistingDeviceUnit() {
|
||||
AddDeviceUnit existing = new AddDeviceUnit();
|
||||
existing.setDevId("device-001");
|
||||
when(deviceUnitMapper.selectById(eq("device-001"))).thenReturn(existing);
|
||||
when(equipmentMapper.selectOne(any())).thenReturn(buildActiveEquipment("device-001"));
|
||||
|
||||
AddDeviceUnitSaveParam param = new AddDeviceUnitSaveParam();
|
||||
param.setDevId("device-001");
|
||||
param.setUnitFrequency("MHz");
|
||||
param.setPhaseVoltage("V");
|
||||
|
||||
AddDeviceUnitVO result = service.saveDeviceUnit(param);
|
||||
|
||||
verify(deviceUnitMapper).updateById(any(AddDeviceUnit.class));
|
||||
Assertions.assertEquals("device-001", result.getDevId());
|
||||
Assertions.assertEquals("MHz", result.getUnitFrequency());
|
||||
Assertions.assertEquals("V", result.getPhaseVoltage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLineOverlimitShouldQueryExistingLineOverlimit() {
|
||||
AddLedgerLinePO line = new AddLedgerLinePO();
|
||||
line.setLineId("line-001");
|
||||
AddOverlimitPO overlimit = new AddOverlimitPO();
|
||||
overlimit.setId("line-001");
|
||||
|
||||
when(lineMapper.selectOne(any())).thenReturn(line);
|
||||
when(overlimitMapper.selectById(eq("line-001"))).thenReturn(overlimit);
|
||||
|
||||
AddOverlimitPO result = service.getLineOverlimit("line-001");
|
||||
|
||||
Assertions.assertSame(overlimit, result);
|
||||
}
|
||||
|
||||
private AddLedgerLineSaveParam buildValidLineParam() {
|
||||
AddLedgerLineSaveParam param = new AddLedgerLineSaveParam();
|
||||
param.setDeviceId("device-001");
|
||||
@@ -63,4 +139,33 @@ class AddLedgerServiceImplTest {
|
||||
param.setPt2Ratio(BigDecimal.ONE);
|
||||
return param;
|
||||
}
|
||||
|
||||
private AddLedgerEquipmentSaveParam buildValidEquipmentParam() {
|
||||
AddLedgerEquipmentSaveParam param = new AddLedgerEquipmentSaveParam();
|
||||
param.setProjectId("project-001");
|
||||
param.setName("设备A");
|
||||
param.setNdid("ndid-001");
|
||||
param.setMac("00:11:22:33:44:55");
|
||||
param.setDevModel("model-001");
|
||||
return param;
|
||||
}
|
||||
|
||||
private AddLedgerLedgerPO buildLedger(String id, String pid, String pids, Integer level) {
|
||||
AddLedgerLedgerPO ledger = new AddLedgerLedgerPO();
|
||||
ledger.setId(id);
|
||||
ledger.setPid(pid);
|
||||
ledger.setPids(pids);
|
||||
ledger.setLevel(level);
|
||||
ledger.setState(AddLedgerConst.STATE_NORMAL);
|
||||
ledger.setName(id);
|
||||
return ledger;
|
||||
}
|
||||
|
||||
private AddLedgerEquipmentPO buildActiveEquipment(String id) {
|
||||
AddLedgerEquipmentPO equipment = new AddLedgerEquipmentPO();
|
||||
equipment.setId(id);
|
||||
equipment.setName("设备A");
|
||||
equipment.setRunStatus(AddLedgerConst.EQUIPMENT_RUN_STATUS_OFFLINE);
|
||||
return equipment;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user