This commit is contained in:
wr
2025-04-09 14:24:19 +08:00
parent 84cd56330e
commit 2c12f4966a

View File

@@ -133,7 +133,7 @@ public class SpecialAnalysisServiceImpl implements ISpecialAnalysisService {
waveDataDTO = (WaveDataDTO) ois.readObject();
bis.close();
ois.close();
Arrays.fill(bytes, (byte)0);
Arrays.fill(bytes, (byte) 0);
} catch (Exception e) {
e.printStackTrace();
}
@@ -167,7 +167,7 @@ public class SpecialAnalysisServiceImpl implements ISpecialAnalysisService {
if (line.getBigObjType().equals(powerStation.getId())) {
if (BooleanUtil.or(isDipThrough(0, 150, 1, voltageLevel, newListRmsData),
isDipThrough(20, 625, 1, voltageLevel, newListRmsData),
isDipThrough(20, 90, null, voltageLevel, newListRmsData))) {
isDipThrough(20, 90, 3, voltageLevel, newListRmsData))) {
spThroughPO.setIsOrNot(1);
}
}
@@ -238,11 +238,7 @@ public class SpecialAnalysisServiceImpl implements ISpecialAnalysisService {
for (int i = 0; i < 10; i++) {
try {
Field minTime = RActivePowerRangeDto.class.getDeclaredField("minsTime" + i);
Field minNum = RActivePowerRangeDto.class.getDeclaredField("minsNum" + i);
Field isOrNot = RActivePowerRangeDto.class.getDeclaredField("isOrNot" + i);
minTime.setAccessible(true);
minNum.setAccessible(true);
isOrNot.setAccessible(true);
minTime.set(dto, "[]");
if (CollUtil.isNotEmpty(min[i])) {
List<String> mins = min[i].stream().distinct().collect(Collectors.toList());
@@ -250,14 +246,16 @@ public class SpecialAnalysisServiceImpl implements ISpecialAnalysisService {
if (CollUtil.isNotEmpty(limitTime)) {
List<String> collect = mins.stream().filter(x -> limitTime.contains(x)).sorted().collect(Collectors.toList());
if (CollUtil.isNotEmpty(collect)) {
Field minNum = RActivePowerRangeDto.class.getDeclaredField("minsNum" + i);
Field isOrNot = RActivePowerRangeDto.class.getDeclaredField("isOrNot" + i);
minNum.setAccessible(true);
isOrNot.setAccessible(true);
minTime.set(dto, JSON.toJSONString(collect));
minNum.set(dto, collect.size());
isOrNot.set(dto, 1);
} else {
minTime.set(dto, "[]");
}
}
}
minNum.set(dto, min[i].size());
} catch (Exception e) {
e.printStackTrace();
}
@@ -374,16 +372,17 @@ public class SpecialAnalysisServiceImpl implements ISpecialAnalysisService {
}
}
if (3 == option) {
//方案三20%以上至90%时,需要判断上升信息
// if (voltageLevel > v && anchorPoint != -1.0) {
// anchorPoint = time + ms;
// } else if (anchorPoint.equals(time)) {
// if (v < voltageLevel*0.9) {
// return true;
// }
// anchorPoint = -1.0;
// }
//todo 方案三20%以上至90%时,需要判断信息
if (NumberUtil.isIn(curValue, BigDecimal.valueOf(20), BigDecimal.valueOf(90))) {
temp.add(num);
} else {
if (CollUtil.isNotEmpty(temp)) {
if (isMonotonic(temp)) {
return true;
}
temp = new ArrayList<>();
}
}
}
}
}
@@ -391,6 +390,32 @@ public class SpecialAnalysisServiceImpl implements ISpecialAnalysisService {
return false;
}
/**
* 判断有不连续的暂降
*
* @param temp
* @return
*/
private boolean isMonotonic(List<String> temp) {
List<Integer> nums = temp.stream().map(x -> Integer.valueOf(x.split("_")[1])).collect(Collectors.toList());
//增加
boolean increasing = true;
//减少
boolean decreasing = true;
for (int i = 0; i < nums.size() - 1; i++) {
if (nums.get(i) > nums.get(i + 1)) {
increasing = false;
}
if (nums.get(i) > nums.get(i + 1)) {
decreasing = false;
}
// 提前终止循环,如果已确定非升序且非降序
if (!increasing && !decreasing) {
break;
}
}
return increasing || decreasing;
}
/**
* 暂升