横向纵向实时打特性点
This commit is contained in:
@@ -342,21 +342,64 @@ public class SocketFreqConverterService {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.lastTolerancePoint.getTolerant() == 1 && testRes.getTolerant() == 0) {
|
||||
TolerantPointVO featurePointVO = new TolerantPointVO();
|
||||
if (testRes.getTolerant() == 0) {
|
||||
if (this.lastTolerancePoint.getTolerant() == 1) {
|
||||
TolerantPointVO featurePointVO = new TolerantPointVO();
|
||||
|
||||
featurePointVO.setResidualVoltage((task.getPqDipData().getResidualVoltage() + this.lastTolerancePoint.getResidualVoltage()) / 2D);
|
||||
featurePointVO.setDurationMs(Integer.valueOf((task.getPqDipData().getDurationMs().intValue() + this.lastTolerancePoint.getDurationMs().intValue()) / 2));
|
||||
featurePointVO.setTolerant(2);
|
||||
socketDataMsg.setData(JSON.toJSONString(featurePointVO));
|
||||
WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg));
|
||||
featurePointVO.setResidualVoltage((task.getPqDipData().getResidualVoltage() + this.lastTolerancePoint.getResidualVoltage()) / 2D);
|
||||
featurePointVO.setDurationMs(Integer.valueOf((task.getPqDipData().getDurationMs().intValue() + this.lastTolerancePoint.getDurationMs().intValue()) / 2));
|
||||
featurePointVO.setTolerant(2);
|
||||
socketDataMsg.setData(JSON.toJSONString(featurePointVO));
|
||||
WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg));
|
||||
|
||||
PqFreqConverterTestRes featureTestRes = new PqFreqConverterTestRes();
|
||||
featureTestRes.setId(IdUtil.fastSimpleUUID());
|
||||
featureTestRes.setDurationMs(featurePointVO.getDurationMs());
|
||||
featureTestRes.setResidualVoltage(featurePointVO.getResidualVoltage());
|
||||
featureTestRes.setTolerant(2);
|
||||
saveTestResList.add(featureTestRes);
|
||||
PqFreqConverterTestRes featureTestRes = new PqFreqConverterTestRes();
|
||||
featureTestRes.setId(IdUtil.fastSimpleUUID());
|
||||
featureTestRes.setDurationMs(featurePointVO.getDurationMs());
|
||||
featureTestRes.setResidualVoltage(featurePointVO.getResidualVoltage());
|
||||
featureTestRes.setTolerant(2);
|
||||
saveTestResList.add(featureTestRes);
|
||||
}
|
||||
|
||||
// 从数据库按照列查询距离该暂降点最近的一个暂降点
|
||||
if (freqConverterConfig.getDirection() == 0) {
|
||||
PqFreqConverterTestRes lastByDuration = pqFreqConverterTestResService.getLastByDuration(suffix, task.getPqDipData().getDurationMs());
|
||||
if (ObjectUtil.isNotNull(lastByDuration) && lastByDuration.getTolerant() == 1) {
|
||||
TolerantPointVO featurePointVO = new TolerantPointVO();
|
||||
|
||||
featurePointVO.setResidualVoltage((task.getPqDipData().getResidualVoltage() + lastByDuration.getResidualVoltage()) / 2D);
|
||||
featurePointVO.setDurationMs(Integer.valueOf((task.getPqDipData().getDurationMs().intValue() + lastByDuration.getDurationMs().intValue()) / 2));
|
||||
featurePointVO.setTolerant(2);
|
||||
socketDataMsg.setData(JSON.toJSONString(featurePointVO));
|
||||
WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg));
|
||||
|
||||
PqFreqConverterTestRes featureTestRes = new PqFreqConverterTestRes();
|
||||
featureTestRes.setId(IdUtil.fastSimpleUUID());
|
||||
featureTestRes.setDurationMs(featurePointVO.getDurationMs());
|
||||
featureTestRes.setResidualVoltage(featurePointVO.getResidualVoltage());
|
||||
featureTestRes.setTolerant(2);
|
||||
saveTestResList.add(featureTestRes);
|
||||
}
|
||||
}
|
||||
// 从数据库按照行查询距离该暂降点最近的一个暂降点
|
||||
if (freqConverterConfig.getDirection() == 0) {
|
||||
PqFreqConverterTestRes lastByResidualVoltage = pqFreqConverterTestResService.getLastByResidualVoltage(suffix, task.getPqDipData().getResidualVoltage());
|
||||
if (ObjectUtil.isNotNull(lastByResidualVoltage) && lastByResidualVoltage.getTolerant() == 1) {
|
||||
TolerantPointVO featurePointVO = new TolerantPointVO();
|
||||
|
||||
featurePointVO.setResidualVoltage((task.getPqDipData().getResidualVoltage() + lastByResidualVoltage.getResidualVoltage()) / 2D);
|
||||
featurePointVO.setDurationMs(Integer.valueOf((task.getPqDipData().getDurationMs().intValue() + lastByResidualVoltage.getDurationMs().intValue()) / 2));
|
||||
featurePointVO.setTolerant(2);
|
||||
socketDataMsg.setData(JSON.toJSONString(featurePointVO));
|
||||
WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg));
|
||||
|
||||
PqFreqConverterTestRes featureTestRes = new PqFreqConverterTestRes();
|
||||
featureTestRes.setId(IdUtil.fastSimpleUUID());
|
||||
featureTestRes.setDurationMs(featurePointVO.getDurationMs());
|
||||
featureTestRes.setResidualVoltage(featurePointVO.getResidualVoltage());
|
||||
featureTestRes.setTolerant(2);
|
||||
saveTestResList.add(featureTestRes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,4 +16,6 @@ public class FreqConverterConfig {
|
||||
private Integer tolerant;
|
||||
private Integer dt;
|
||||
private Integer direction;
|
||||
private Integer allowErrorDuration;
|
||||
private Double allowErrorResidualVoltage;
|
||||
}
|
||||
|
||||
@@ -53,4 +53,7 @@ public interface IPqFreqConverterTestResService extends IService<PqFreqConverter
|
||||
*/
|
||||
List<PqFreqConverterTestRes> listTestRes(Integer suffix);
|
||||
|
||||
PqFreqConverterTestRes getLastByDuration(Integer suffix, Integer durationMs);
|
||||
|
||||
PqFreqConverterTestRes getLastByResidualVoltage(Integer suffix, Double residualVoltage);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.njcn.gather.freqConverter.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||
import com.njcn.gather.freqConverter.config.FreqConverterConfig;
|
||||
import com.njcn.gather.freqConverter.mapper.PqFreqConverterTestResMapper;
|
||||
import com.njcn.gather.freqConverter.pojo.po.PqFreqConverterTestRes;
|
||||
import com.njcn.gather.freqConverter.service.IPqFreqConverterTestResService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -14,7 +17,10 @@ import java.util.List;
|
||||
* @data 2026-04-14
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class PqFreqConverterTestResServiceImpl extends ServiceImpl<PqFreqConverterTestResMapper, PqFreqConverterTestRes> implements IPqFreqConverterTestResService {
|
||||
private final FreqConverterConfig freqConverterConfig;
|
||||
|
||||
@Override
|
||||
public void clearAllData(Integer suffix) {
|
||||
DynamicTableNameHandler.setTableName(PqFreqConverterConfigServiceImpl.PQ_FREQ_CONVERTER_TEST_RES_TB_PREFIX + suffix);
|
||||
@@ -51,4 +57,27 @@ public class PqFreqConverterTestResServiceImpl extends ServiceImpl<PqFreqConvert
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqFreqConverterTestRes getLastByDuration(Integer suffix, Integer durationMs) {
|
||||
DynamicTableNameHandler.setTableName(PqFreqConverterConfigServiceImpl.PQ_FREQ_CONVERTER_TEST_RES_TB_PREFIX + suffix);
|
||||
LambdaQueryWrapper<PqFreqConverterTestRes> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.between(PqFreqConverterTestRes::getDurationMs, durationMs - freqConverterConfig.getAllowErrorDuration(), durationMs + freqConverterConfig.getAllowErrorDuration())
|
||||
.orderByAsc(PqFreqConverterTestRes::getResidualVoltage)
|
||||
.last("limit 1");
|
||||
PqFreqConverterTestRes result = this.getOne(queryWrapper);
|
||||
DynamicTableNameHandler.remove();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqFreqConverterTestRes getLastByResidualVoltage(Integer suffix, Double residualVoltage) {
|
||||
DynamicTableNameHandler.setTableName(PqFreqConverterConfigServiceImpl.PQ_FREQ_CONVERTER_TEST_RES_TB_PREFIX + suffix);
|
||||
LambdaQueryWrapper<PqFreqConverterTestRes> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.between(PqFreqConverterTestRes::getResidualVoltage, residualVoltage - freqConverterConfig.getAllowErrorResidualVoltage(), residualVoltage + freqConverterConfig.getAllowErrorDuration())
|
||||
.orderByDesc(PqFreqConverterTestRes::getDurationMs)
|
||||
.last("limit 1");
|
||||
PqFreqConverterTestRes result = this.getOne(queryWrapper);
|
||||
DynamicTableNameHandler.remove();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ spring:
|
||||
# url: jdbc:mysql://192.168.1.24:13306/pqs91002?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
|
||||
# username: root
|
||||
# password: njcnpqs
|
||||
url: jdbc:mysql://192.168.1.24:13306/pqs9100?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
|
||||
url: jdbc:mysql://192.168.1.24:13306/pqs9100_hn?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
|
||||
username: root
|
||||
password: njcnpqs
|
||||
#初始化建立物理连接的个数、最小、最大连接数
|
||||
@@ -131,4 +131,6 @@ freq-converter:
|
||||
schedule-period: 200 #定时器运行间隔
|
||||
tolerant: 1 #耐受状态
|
||||
dt: 200 #延迟时间ms
|
||||
direction: 1 #0为横向1为纵向
|
||||
direction: 1 #0为横向1为纵向
|
||||
allow-error-duration: 6 #暂态持续时间允许最大误差ms
|
||||
allow-error-vesidual-voltage: 2.0 #暂态幅值允许最多误差%
|
||||
Reference in New Issue
Block a user