Compare commits
2 Commits
99c7448544
...
503018a721
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
503018a721 | ||
|
|
391fd0cf4f |
@@ -370,6 +370,7 @@ public class SocketFreqConverterDevService {
|
|||||||
String freqConverterTag = currentUserId + CnSocketUtil.FREQ_CONVERTER_TAG;
|
String freqConverterTag = currentUserId + CnSocketUtil.FREQ_CONVERTER_TAG;
|
||||||
// 避免过早把 freqConverterTableSuffix 等全局值清掉,造成变频器无法使用全局变量
|
// 避免过早把 freqConverterTableSuffix 等全局值清掉,造成变频器无法使用全局变量
|
||||||
if (!SocketManager.isChannelActive(freqConverterTag)) {
|
if (!SocketManager.isChannelActive(freqConverterTag)) {
|
||||||
|
FormalTestManager.freqConverterStep = null;
|
||||||
FormalTestManager.clearFreqConverterRuntimeState();
|
FormalTestManager.clearFreqConverterRuntimeState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ public class SocketFreqConverterService {
|
|||||||
String devTag = currentUserId + CnSocketUtil.DEV_TAG;
|
String devTag = currentUserId + CnSocketUtil.DEV_TAG;
|
||||||
// 避免过早把 freqConverterTableSuffix 等全局值清掉,造成设备无法使用全局变量
|
// 避免过早把 freqConverterTableSuffix 等全局值清掉,造成设备无法使用全局变量
|
||||||
if (!SocketManager.isChannelActive(devTag)) {
|
if (!SocketManager.isChannelActive(devTag)) {
|
||||||
|
FormalTestManager.freqConverterDevStep = null;
|
||||||
FormalTestManager.clearFreqConverterRuntimeState();
|
FormalTestManager.clearFreqConverterRuntimeState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,8 +230,6 @@ public class FormalTestManager {
|
|||||||
* 清理变频器耐受实验运行态数据
|
* 清理变频器耐受实验运行态数据
|
||||||
*/
|
*/
|
||||||
public static void clearFreqConverterRuntimeState() {
|
public static void clearFreqConverterRuntimeState() {
|
||||||
freqConverterStep = null;
|
|
||||||
freqConverterDevStep = null;
|
|
||||||
currentFreqConverterId = null;
|
currentFreqConverterId = null;
|
||||||
freqConverterTableSuffix = null;
|
freqConverterTableSuffix = null;
|
||||||
pendingDipTaskMap.clear();
|
pendingDipTaskMap.clear();
|
||||||
|
|||||||
@@ -18,11 +18,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -128,11 +124,32 @@ public class FreqConverterServiceImpl extends ServiceImpl<FreqConverterStatusMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<Integer, List<TolerantPointVO>> durationPointMap = dipPoints.stream()
|
Map<Integer, List<TolerantPointVO>> durationPointMap = dipPoints.stream()
|
||||||
.collect(Collectors.groupingBy(TolerantPointVO::getDurationMs));
|
.collect(Collectors.groupingBy(TolerantPointVO::getDurationMs, TreeMap::new, Collectors.toList()));
|
||||||
|
if (durationPointMap.size() < 2) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
List<TolerantPointVO> result = new ArrayList<>();
|
List<TolerantPointVO> result = new ArrayList<>();
|
||||||
|
|
||||||
|
TolerantPointVO firstPoint = new TolerantPointVO();
|
||||||
|
|
||||||
|
List<Integer> keyList = durationPointMap.keySet().stream().collect(Collectors.toList());
|
||||||
|
Integer i1 = keyList.get(0);
|
||||||
|
List<TolerantPointVO> tolerantPointVOS1 = durationPointMap.get(i1);
|
||||||
|
Collections.sort(tolerantPointVOS1,Comparator.comparing(TolerantPointVO::getResidualVoltage));
|
||||||
|
TolerantPointVO tolerantPointVO1 = tolerantPointVOS1.get(0);
|
||||||
|
|
||||||
|
Integer i2 = keyList.get(1);
|
||||||
|
List<TolerantPointVO> tolerantPointVOS2 = durationPointMap.get(i2);
|
||||||
|
Collections.sort(tolerantPointVOS2,Comparator.comparing(TolerantPointVO::getResidualVoltage));
|
||||||
|
TolerantPointVO tolerantPointVO2 = tolerantPointVOS2.get(0);
|
||||||
|
|
||||||
|
firstPoint.setDurationMs((i1 + i2)/2);
|
||||||
|
firstPoint.setResidualVoltage((tolerantPointVO1.getResidualVoltage() + tolerantPointVO2.getResidualVoltage()) / 2D);
|
||||||
|
firstPoint.setTolerant(2);
|
||||||
|
result.add(firstPoint);
|
||||||
|
|
||||||
durationPointMap.entrySet().stream()
|
durationPointMap.entrySet().stream()
|
||||||
.sorted(Map.Entry.comparingByKey())
|
|
||||||
.forEach(entry -> {
|
.forEach(entry -> {
|
||||||
List<TolerantPointVO> sameDurationPoints = entry.getValue().stream()
|
List<TolerantPointVO> sameDurationPoints = entry.getValue().stream()
|
||||||
.sorted(Comparator.comparing(TolerantPointVO::getResidualVoltage, Comparator.reverseOrder()))
|
.sorted(Comparator.comparing(TolerantPointVO::getResidualVoltage, Comparator.reverseOrder()))
|
||||||
|
|||||||
Reference in New Issue
Block a user