微调
This commit is contained in:
@@ -15,7 +15,7 @@ public class DetectionData {
|
||||
/**
|
||||
* 第几次谐波
|
||||
*/
|
||||
private Integer num;
|
||||
private Double num;
|
||||
|
||||
/**
|
||||
* 原始数据
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.njcn.gather.detection.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.njcn.gather.detection.pojo.po.DevData;
|
||||
import com.njcn.gather.detection.pojo.vo.DetectionData;
|
||||
import com.njcn.gather.device.err.pojo.param.PqErrSysParam;
|
||||
@@ -89,9 +90,39 @@ public class DetectionServiceImpl {
|
||||
case "I":
|
||||
return isQualified(dev, devIdMapComm, pqErrSysDtls, I, sourceIssue, dataRule, "IRMS").getResultFlag();
|
||||
/**
|
||||
* 谐波类
|
||||
* 谐波电压
|
||||
*/
|
||||
case "H":
|
||||
case "HV":
|
||||
return isHarmQualified(dev, devIdMapComm, pqErrSysDtls, U, sourceIssue, DictDataEnum.AT_WILL_VALUE, 2).getResultFlag();
|
||||
/**
|
||||
* 谐波电流
|
||||
*/
|
||||
case "HI":
|
||||
return isHarmQualified(dev, devIdMapComm, pqErrSysDtls, I, sourceIssue, DictDataEnum.AT_WILL_VALUE, 2).getResultFlag();
|
||||
/**
|
||||
* 谐波有功功率
|
||||
*/
|
||||
case "HP":
|
||||
break;
|
||||
/**
|
||||
* 间谐波电压
|
||||
*/
|
||||
case "HSV":
|
||||
return isHarmQualified(dev, devIdMapComm, pqErrSysDtls, U, sourceIssue, DictDataEnum.AT_WILL_VALUE, 2).getResultFlag();
|
||||
/**
|
||||
* 间谐波电流
|
||||
*/
|
||||
case "HSI":
|
||||
return isHarmQualified(dev, devIdMapComm, pqErrSysDtls, I, sourceIssue, DictDataEnum.AT_WILL_VALUE, 2).getResultFlag();
|
||||
/**
|
||||
* 三相电压不平衡度
|
||||
*/
|
||||
case "IMBV":
|
||||
break;
|
||||
/**
|
||||
* 三相电流不平衡度
|
||||
*/
|
||||
case "IMBA":
|
||||
break;
|
||||
/**
|
||||
* 功率
|
||||
@@ -259,7 +290,7 @@ public class DetectionServiceImpl {
|
||||
* @return
|
||||
*/
|
||||
public AdHarmonicResult isHarmQualified(List<DevData> dev, Map<String, String> devIdMapComm, List<PqErrSysDtls> pqErrSysDtls, String type, SourceIssue sourceIssue, DictDataEnum dataRule, Integer num) {
|
||||
Map<String, Map<Integer, List<Double>>> devMap = devHarmListMap(dev, sourceIssue, dataRule, num);
|
||||
Map<String, Map<Double, List<Double>>> devMap = devHarmListMap(dev, sourceIssue, dataRule, num);
|
||||
Double fData = 1.0;
|
||||
if (U.equals(type)) {
|
||||
fData = sourceIssue.getFUn();
|
||||
@@ -297,11 +328,11 @@ public class DetectionServiceImpl {
|
||||
}
|
||||
|
||||
private void reflectHarmonic(String phase, List<DetectionData> integerBooleanA, AdHarmonicResult harmonicResult) {
|
||||
Map<Integer, DetectionData> dataMap = integerBooleanA.stream().collect(Collectors.toMap(DetectionData::getNum, Function.identity()));
|
||||
Map<Double, DetectionData> dataMap = integerBooleanA.stream().collect(Collectors.toMap(DetectionData::getNum, Function.identity()));
|
||||
dataMap.forEach((key, value) -> {
|
||||
try {
|
||||
// 设置 id 字段
|
||||
Field idField = AdHarmonicResult.class.getDeclaredField(phase + "Value" + key);
|
||||
Field idField = AdHarmonicResult.class.getDeclaredField(phase + "Value" + key.intValue());
|
||||
idField.setAccessible(true);
|
||||
if (ObjectUtil.isNull(value.getIsData())) {
|
||||
idField.set(harmonicResult, value.getData());
|
||||
@@ -366,14 +397,14 @@ public class DetectionServiceImpl {
|
||||
* @param fData
|
||||
* @return
|
||||
*/
|
||||
public List<DetectionData> harmRangeComparison(List<PqErrSysDtls> pqErrSysDtls, String type, String phase, SourceIssue sourceIssue, DictDataEnum dataRule, Map<Integer, List<Double>> devMap, Double fData) {
|
||||
public List<DetectionData> harmRangeComparison(List<PqErrSysDtls> pqErrSysDtls, String type, String phase, SourceIssue sourceIssue, DictDataEnum dataRule, Map<Double, List<Double>> devMap, Double fData) {
|
||||
List<DetectionData> info = new ArrayList<>();
|
||||
//根据谐波几次相值/额定值
|
||||
Map<Integer, Double> issueHarmMap = sourceIssue.getChannelList().stream()
|
||||
Map<Double, Double> issueHarmMap = sourceIssue.getChannelList().stream()
|
||||
.filter(x -> (type + phase.toLowerCase()).equals(x.getChannelType()))
|
||||
.flatMap(x -> x.getHarmList().stream())
|
||||
.collect(Collectors.toMap(SourceIssue.ChannelListDTO.HarmModel::getHarm, x -> x.getFApm()));
|
||||
Map<Integer, PqErrSysDtls> errSysDtlMap = new LinkedHashMap<>();
|
||||
Map<Double, PqErrSysDtls> errSysDtlMap = new LinkedHashMap<>();
|
||||
issueHarmMap.forEach((key, value) -> {
|
||||
//获得误差体系
|
||||
List<PqErrSysDtls> errSysDtls = pqErrSysDtls.stream().filter(x -> rangeComparison(x.getStartValue(),
|
||||
@@ -447,11 +478,18 @@ public class DetectionServiceImpl {
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Map<Integer, List<Double>>> devHarmListMap(List<DevData> dev, SourceIssue sourceIssue, DictDataEnum dataRule, Integer num) {
|
||||
Map<String, Map<Integer, List<Double>>> map = new HashMap<>(3);
|
||||
List<Integer> harmNum = sourceIssue.getChannelList().stream()
|
||||
.flatMap(x -> x.getHarmList().stream().map(f -> f.getHarm()))
|
||||
.sorted().distinct().collect(Collectors.toList());
|
||||
public Map<String, Map<Double, List<Double>>> devHarmListMap(List<DevData> dev, SourceIssue sourceIssue, DictDataEnum dataRule, Integer num) {
|
||||
Map<String, Map<Double, List<Double>>> map = new HashMap<>(3);
|
||||
List<Double> harmNum;
|
||||
if (1 == num) {
|
||||
harmNum = sourceIssue.getChannelList().stream()
|
||||
.flatMap(x -> x.getInharmList().stream().map(f -> f.getInharm()))
|
||||
.sorted().distinct().collect(Collectors.toList());
|
||||
} else {
|
||||
harmNum = sourceIssue.getChannelList().stream()
|
||||
.flatMap(x -> x.getHarmList().stream().map(f -> f.getHarm()))
|
||||
.sorted().distinct().collect(Collectors.toList());
|
||||
}
|
||||
for (DevData devData : dev) {
|
||||
DevData.SqlDataDTO fund = devData.getSqlData().stream().collect(Collectors.toList()).stream().findFirst().get();
|
||||
DevData.SqlDataHarmDTO harm = devData.getSqlDataHarm().stream().filter(x -> 49 == x.getNum()).collect(Collectors.toList()).stream().findFirst().get();
|
||||
@@ -609,36 +647,36 @@ public class DetectionServiceImpl {
|
||||
* @param harm 基波信息
|
||||
* @param fund 2-50次谐波信息
|
||||
*/
|
||||
public void harmPut(String type, Map<String, Map<Integer, List<Double>>> map, List<Integer> harmNum, DevData.SqlDataHarmDTO harm, String fund, Integer num) {
|
||||
public void harmPut(String type, Map<String, Map<Double, List<Double>>> map, List<Double> harmNum, DevData.SqlDataHarmDTO harm, String fund, Integer num) {
|
||||
if (map.containsKey(type)) {
|
||||
Map<Integer, List<Double>> integerListMap = map.get(type);
|
||||
for (Integer i : harmNum) {
|
||||
Map<Double, List<Double>> integerListMap = map.get(type);
|
||||
for (Double i : harmNum) {
|
||||
if (integerListMap.containsKey(i)) {
|
||||
if (type.equals("A")) {
|
||||
integerListMap.get(i).add(multiply(harm.getList().getA().get(i - num), fund));
|
||||
integerListMap.get(num!=1?i:i+0.5).add(multiply(harm.getList().getA().get((int) (i - num)), fund));
|
||||
}
|
||||
if (type.equals("B")) {
|
||||
integerListMap.get(i).add(multiply(harm.getList().getB().get(i - num), fund));
|
||||
integerListMap.get(num!=1?i:i+0.5).add(multiply(harm.getList().getB().get((int) (i - num)), fund));
|
||||
}
|
||||
if (type.equals("C")) {
|
||||
integerListMap.get(i).add(multiply(harm.getList().getC().get(i - num), fund));
|
||||
integerListMap.get(num!=1?i:i+0.5).add(multiply(harm.getList().getC().get((int) (i - num)), fund));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Map<Integer, List<Double>> integerListMap = new LinkedHashMap<>(5);
|
||||
for (Integer i : harmNum) {
|
||||
Map<Double, List<Double>> integerListMap = new LinkedHashMap<>(5);
|
||||
for (Double i : harmNum) {
|
||||
List<Double> integerList = new ArrayList<>();
|
||||
if (type.equals("A")) {
|
||||
integerList.add(multiply(harm.getList().getA().get(i - num), fund));
|
||||
integerList.add(multiply(harm.getList().getA().get((int) (i - num)), fund));
|
||||
}
|
||||
if (type.equals("B")) {
|
||||
integerList.add(multiply(harm.getList().getB().get(i - num), fund));
|
||||
integerList.add(multiply(harm.getList().getB().get((int) (i - num)), fund));
|
||||
}
|
||||
if (type.equals("C")) {
|
||||
integerList.add(multiply(harm.getList().getC().get(i - num), fund));
|
||||
integerList.add(multiply(harm.getList().getC().get((int) (i - num)), fund));
|
||||
}
|
||||
integerListMap.put(i, integerList);
|
||||
integerListMap.put(num!=1?i:i+0.5, integerList);
|
||||
}
|
||||
map.put(type, integerListMap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user