|
|
|
|
@@ -303,7 +303,7 @@ public class DetectionServiceImpl {
|
|
|
|
|
if (devIndex.contains("P")) {
|
|
|
|
|
type = P;
|
|
|
|
|
harmCode = DetectionCodeEnum.P2_50.getCode();
|
|
|
|
|
fData = sourceIssue.getFIn() * sourceIssue.getFUn() * 0.01;
|
|
|
|
|
fData = (sourceIssue.getFIn() * sourceIssue.getFUn()) * 0.01;
|
|
|
|
|
}
|
|
|
|
|
Map<String, Map<Double, List<Double>>> devHarmMap = devHarmListMap(dev, sourceIssue, dataRule, fundCode, harmCode, num);
|
|
|
|
|
if (CollUtil.isNotEmpty(devHarmMap)) {
|
|
|
|
|
@@ -487,7 +487,7 @@ public class DetectionServiceImpl {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (P.equals(type)) {
|
|
|
|
|
fData = sourceIssue.getFIn() * sourceIssue.getFUn() * 0.01;
|
|
|
|
|
fData = (sourceIssue.getFIn() * sourceIssue.getFUn()) * 0.01;
|
|
|
|
|
harmCode = DetectionCodeEnum.P2_50.getCode();
|
|
|
|
|
}
|
|
|
|
|
Map<String, Map<Double, List<Double>>> devMap = devHarmListMap(dev, sourceIssue, dataRule, fundCode, harmCode, num);
|
|
|
|
|
@@ -613,6 +613,14 @@ public class DetectionServiceImpl {
|
|
|
|
|
/**
|
|
|
|
|
* 判断值是否在误差范围内,有则进行判断否则则不进行计算(暂态)
|
|
|
|
|
*
|
|
|
|
|
* (假如都符合,则选取最开始合格的,都不合格,取最开始不合格的)
|
|
|
|
|
* 方案一 分项问题
|
|
|
|
|
* 分别计算各个相别是否合格
|
|
|
|
|
* 不合格电压幅值的层级最高
|
|
|
|
|
*
|
|
|
|
|
* 方案二 不分项问题
|
|
|
|
|
* 以电压幅值最低的作为比较相别
|
|
|
|
|
*
|
|
|
|
|
* @param dev 处理过后的数据
|
|
|
|
|
* @param errDtlsCheckData 误差体系
|
|
|
|
|
* @param sourceIssue 源下发所对应的参数
|
|
|
|
|
@@ -635,14 +643,80 @@ public class DetectionServiceImpl {
|
|
|
|
|
//暂态电压下多少就是多少
|
|
|
|
|
List<ErrDtlsCheckDataVO> magErrList = errDtlsCheckData.stream().filter(x -> MAG.equals(x.getValueTypeCode())).collect(Collectors.toList());
|
|
|
|
|
List<ErrDtlsCheckDataVO> durErrList = errDtlsCheckData.stream().filter(x -> DUR.equals(x.getValueTypeCode())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
AdNonHarmonicResult magResult = voltageResult(dev.get(0).getId(), devIdMapComm, sourceIssue, dataRule, mag, magErrList, sourceIssue.getFUn(), MAG);
|
|
|
|
|
AdNonHarmonicResult durResult = voltageResult(dev.get(0).getId(), devIdMapComm, sourceIssue, dataRule, dur, durErrList, sourceIssue.getFFreq(), DUR);
|
|
|
|
|
if (CollUtil.isNotEmpty(mag.get(TYPE_B)) && CollUtil.isNotEmpty(mag.get(TYPE_C))) {
|
|
|
|
|
conclusion(magResult, durResult);
|
|
|
|
|
}
|
|
|
|
|
detectionDataDealService.acceptAdNonResult(Arrays.asList(magResult, durResult), code);
|
|
|
|
|
List<Integer> numbers = Arrays.asList(magResult.getResultFlag(), durResult.getResultFlag()).stream().distinct().collect(Collectors.toList());
|
|
|
|
|
return getInteger(numbers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param magResult 电压幅值结果
|
|
|
|
|
* @param durResult 持续时间结果
|
|
|
|
|
* @Description:
|
|
|
|
|
* @Author: wr
|
|
|
|
|
* @Date: 2025/4/9 18:54
|
|
|
|
|
*/
|
|
|
|
|
private void conclusion(AdNonHarmonicResult magResult, AdNonHarmonicResult durResult) {
|
|
|
|
|
if (magResult.getResultFlag() == 1) {
|
|
|
|
|
if (durResult.getResultFlag() != 2) {
|
|
|
|
|
setTValueBasedOnAValue(magResult, durResult);
|
|
|
|
|
} else {
|
|
|
|
|
setTValueBasedOnAValue(magResult, durResult, false);
|
|
|
|
|
}
|
|
|
|
|
} else if (magResult.getResultFlag() == 2) {
|
|
|
|
|
setTValueBasedOnAValue(magResult, durResult, true);
|
|
|
|
|
} else {
|
|
|
|
|
setTValueBasedOnAValue(magResult, durResult);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setTValueBasedOnAValue(AdNonHarmonicResult magResult, AdNonHarmonicResult durResult, Boolean isMag) {
|
|
|
|
|
DetectionData a;
|
|
|
|
|
DetectionData b;
|
|
|
|
|
DetectionData c;
|
|
|
|
|
if (isMag) {
|
|
|
|
|
a = JSON.parseObject(magResult.getAValue(), DetectionData.class);
|
|
|
|
|
b = JSON.parseObject(magResult.getBValue(), DetectionData.class);
|
|
|
|
|
c = JSON.parseObject(magResult.getCValue(), DetectionData.class);
|
|
|
|
|
} else {
|
|
|
|
|
a = JSON.parseObject(durResult.getAValue(), DetectionData.class);
|
|
|
|
|
b = JSON.parseObject(durResult.getBValue(), DetectionData.class);
|
|
|
|
|
c = JSON.parseObject(durResult.getCValue(), DetectionData.class);
|
|
|
|
|
}
|
|
|
|
|
if (a.getIsData() == 2) {
|
|
|
|
|
setTValueBasedOnAValue(magResult, durResult);
|
|
|
|
|
} else if (b.getIsData() == 2) {
|
|
|
|
|
setTValueBasedOnBValue(magResult, durResult);
|
|
|
|
|
} else if (c.getIsData() == 2) {
|
|
|
|
|
setTValueBasedOnCValue(magResult, durResult);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param magResult 电压幅值结果
|
|
|
|
|
* @param durResult 持续时间结果
|
|
|
|
|
* @Description:
|
|
|
|
|
* @Author: wr
|
|
|
|
|
*/
|
|
|
|
|
private void setTValueBasedOnAValue(AdNonHarmonicResult magResult, AdNonHarmonicResult durResult) {
|
|
|
|
|
magResult.setTValue(magResult.getAValue());
|
|
|
|
|
durResult.setTValue(durResult.getAValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setTValueBasedOnBValue(AdNonHarmonicResult magResult, AdNonHarmonicResult durResult) {
|
|
|
|
|
magResult.setTValue(magResult.getBValue());
|
|
|
|
|
durResult.setTValue(durResult.getBValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setTValueBasedOnCValue(AdNonHarmonicResult magResult, AdNonHarmonicResult durResult) {
|
|
|
|
|
magResult.setTValue(magResult.getCValue());
|
|
|
|
|
durResult.setTValue(durResult.getCValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param devId 装置监测点id(ip_通道)
|
|
|
|
|
* @param devIdMapComm ip_通道,装置名称
|
|
|
|
|
@@ -683,13 +757,6 @@ public class DetectionServiceImpl {
|
|
|
|
|
magErrList = errDtlsCheckData.get(0).getErrSysDtls();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//取出源所对应的相别信息
|
|
|
|
|
List<SourceIssue.ChannelListDTO> channelTypeAList = sourceIssue.getChannelList().stream()
|
|
|
|
|
.filter(x -> ("Ua").equals(x.getChannelType()))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
DetectionData a = setDetectionData(isQualified, valueTypeCode, dataRule, mag, fData, dur, magErrList, channelTypeAList, TYPE_A);
|
|
|
|
|
result.setAValue(JSON.toJSONString(a));
|
|
|
|
|
|
|
|
|
|
List<SourceIssue.ChannelListDTO> channelTypeBList = sourceIssue.getChannelList().stream()
|
|
|
|
|
.filter(x -> ("Ub").equals(x.getChannelType()))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
@@ -703,18 +770,47 @@ public class DetectionServiceImpl {
|
|
|
|
|
DetectionData c = setDetectionData(isQualified, valueTypeCode, dataRule, mag, fData, dur, magErrList, channelTypeCList, TYPE_C);
|
|
|
|
|
result.setCValue(JSON.toJSONString(c));
|
|
|
|
|
|
|
|
|
|
result.setResultFlag(setResultFlag(Arrays.asList(a, b, c)));
|
|
|
|
|
if (CollUtil.isNotEmpty(mag.get(TYPE_B)) &&CollUtil.isNotEmpty(mag.get(TYPE_C))) {
|
|
|
|
|
//取出源所对应的相别信息
|
|
|
|
|
List<SourceIssue.ChannelListDTO> channelTypeAList = sourceIssue.getChannelList().stream()
|
|
|
|
|
.filter(x -> ("Ua").equals(x.getChannelType()))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
DetectionData a = setDetectionData(isQualified, valueTypeCode, dataRule, mag, fData, dur, magErrList, channelTypeAList, TYPE_A);
|
|
|
|
|
result.setAValue(JSON.toJSONString(a));
|
|
|
|
|
result.setResultFlag(setResultFlag(Arrays.asList(a, b, c)));
|
|
|
|
|
}else {
|
|
|
|
|
List<SourceIssue.ChannelListDTO> channelTypeAList = sourceIssue.getChannelList().stream()
|
|
|
|
|
.filter(x -> x.getChannelType().contains("U"))
|
|
|
|
|
.sorted(Comparator.comparing(
|
|
|
|
|
x -> Optional.ofNullable(x.getDipData())
|
|
|
|
|
.map(SourceIssue.ChannelListDTO.DipDataDTO::getFTransValue)
|
|
|
|
|
.orElse(Double.NaN)
|
|
|
|
|
))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
DetectionData a = setDetectionData(isQualified, valueTypeCode, dataRule, mag, fData, dur, magErrList, channelTypeAList, TYPE_A);
|
|
|
|
|
result.setAValue(JSON.toJSONString(a));
|
|
|
|
|
result.setTValue(JSON.toJSONString(a));
|
|
|
|
|
result.setResultFlag(a.getIsData());
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DetectionData setDetectionData(Integer isQualified, String valueTypeCode, DictDataEnum dataRule, Map<String, List<Double>> mag, Double fData, String dur, List<PqErrSysDtls> magErrList, List<SourceIssue.ChannelListDTO> channelTypeCList, String typeC) {
|
|
|
|
|
private DetectionData setDetectionData(Integer isQualified,
|
|
|
|
|
String valueTypeCode,
|
|
|
|
|
DictDataEnum dataRule,
|
|
|
|
|
Map<String, List<Double>> mag,
|
|
|
|
|
Double fData,
|
|
|
|
|
String dur,
|
|
|
|
|
List<PqErrSysDtls> magErrList,
|
|
|
|
|
List<SourceIssue.ChannelListDTO> channelTypeCList,
|
|
|
|
|
String typeC) {
|
|
|
|
|
DetectionData c;
|
|
|
|
|
if (DUR.equals(dur)) {
|
|
|
|
|
c = rangeDURComparisonList(mag.get(typeC), isQualified, valueTypeCode, magErrList, fData, channelTypeCList.get(0).getDipData().getRetainTime(), dataRule);
|
|
|
|
|
} else {
|
|
|
|
|
List<Double> ampData = mag.get(typeC).stream()
|
|
|
|
|
.filter(x -> ObjectUtil.isNotNull(x))
|
|
|
|
|
.map(x -> x * channelTypeCList.get(0).getFAmp() * 0.01)
|
|
|
|
|
.map(x -> NumberUtil.round(x * channelTypeCList.get(0).getFAmp() * 0.01, 4).doubleValue())
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
c = rangeComparisonList(ampData, isQualified, valueTypeCode, magErrList, fData, channelTypeCList.get(0).getDipData().getFTransValue(), dataRule);
|
|
|
|
|
}
|
|
|
|
|
@@ -1125,8 +1221,8 @@ public class DetectionServiceImpl {
|
|
|
|
|
nf.setMaximumFractionDigits(6);
|
|
|
|
|
nf.setGroupingUsed(false);
|
|
|
|
|
detectionData.setUnit(unit(valueTypeCode, errSysDtl.getErrorValueType()));
|
|
|
|
|
detectionData.setRadius(nf.format(BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())))
|
|
|
|
|
+ "~" + nf.format(BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue()))));
|
|
|
|
|
detectionData.setRadius(nf.format(BigDecimal.valueOf(-1.0 / data))
|
|
|
|
|
+ "~" + nf.format(BigDecimal.valueOf(1.0 / data)));
|
|
|
|
|
List<Double> qualifiedList = list.stream()
|
|
|
|
|
.filter(x -> NumberUtil.isIn(BigDecimal.valueOf(x.doubleValue()),
|
|
|
|
|
BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())),
|
|
|
|
|
@@ -1134,14 +1230,14 @@ public class DetectionServiceImpl {
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(qualifiedList)) {
|
|
|
|
|
BigDecimal subtract = BigDecimal.valueOf(qualifiedList.get(0))
|
|
|
|
|
.subtract(BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())));
|
|
|
|
|
.subtract(BigDecimal.valueOf(1.0 / data * (channelData)));
|
|
|
|
|
detectionData.setErrorData(subtract);
|
|
|
|
|
} else {
|
|
|
|
|
BigDecimal subtract = BigDecimal.valueOf(list.get(0))
|
|
|
|
|
.subtract(BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())));
|
|
|
|
|
.subtract(BigDecimal.valueOf(1.0 / data * (channelData)));
|
|
|
|
|
detectionData.setErrorData(subtract);
|
|
|
|
|
}
|
|
|
|
|
isData(dataRule, qualifiedList, detectionData, qualifiedList);
|
|
|
|
|
isData(dataRule, list, detectionData, qualifiedList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return detectionData;
|
|
|
|
|
@@ -1157,7 +1253,8 @@ public class DetectionServiceImpl {
|
|
|
|
|
* @param devData 装置上送值
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Boolean rangeComparison(Double startValue, Integer startFlag, Double endValue, Integer endFlag, Double devData) {
|
|
|
|
|
public Boolean rangeComparison(Double startValue, Integer startFlag, Double endValue, Integer endFlag, Double
|
|
|
|
|
devData) {
|
|
|
|
|
Boolean minBool = null;
|
|
|
|
|
Boolean maxBool = null;
|
|
|
|
|
if (ObjectUtil.isNotNull(startValue)) {
|
|
|
|
|
@@ -1288,7 +1385,9 @@ public class DetectionServiceImpl {
|
|
|
|
|
* @param harm 基波信息
|
|
|
|
|
* @param fund 2-50次谐波信息
|
|
|
|
|
*/
|
|
|
|
|
public void harmPut(String type, Map<String, Map<Double, List<Double>>> map, List<Double> 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<Double, List<Double>> integerListMap = map.get(type);
|
|
|
|
|
for (Double i : harmNum) {
|
|
|
|
|
|