11 Commits

Author SHA1 Message Date
caozehui
4afcec7fb9 Revert "sntp"
This reverts commit a48dad40f6.
2026-06-04 17:34:02 +08:00
caozehui
a48dad40f6 sntp 2026-06-04 17:23:44 +08:00
caozehui
c8217046c6 忽略中断事件 2026-06-04 11:08:51 +08:00
caozehui
0a16a1fee5 统一sourceId 2026-05-12 10:34:46 +08:00
caozehui
391646d416 微调 2026-05-08 13:55:48 +08:00
caozehui
4f3f0833d5 微调 2026-05-08 13:15:28 +08:00
caozehui
924c2e8f45 微调 2026-05-08 10:39:27 +08:00
caozehui
8dca7bf537 微调 2026-05-08 10:37:58 +08:00
caozehui
7e6fb2d981 特性点顺序问题 2026-05-07 19:18:42 +08:00
caozehui
ec9a0ca236 微调 2026-05-07 16:27:49 +08:00
caozehui
7ab5b9a501 横向纵向实时打特性点 2026-05-07 15:21:35 +08:00
13 changed files with 133 additions and 47 deletions

View File

@@ -33,6 +33,8 @@ import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
import com.njcn.gather.script.pojo.po.SourceIssue;
import com.njcn.gather.script.service.IPqScriptCheckDataService;
import com.njcn.gather.script.service.IPqScriptDtlsService;
import com.njcn.gather.source.pojo.po.SourceInitialize;
import com.njcn.gather.source.service.IPqSourceService;
import com.njcn.gather.storage.pojo.param.StorageParam;
import com.njcn.gather.storage.pojo.po.SimAndDigHarmonicResult;
import com.njcn.gather.storage.pojo.po.SimAndDigNonHarmonicResult;
@@ -76,6 +78,7 @@ public class SocketDevResponseService {
private final SimAndDigHarmonicService adHarmonicService;
private final IAdPlanService adPlanService;
private final IDictDataService dictDataService;
private final IPqSourceService pqSourceService;
/**
* 存储的装置相序数据
@@ -391,6 +394,8 @@ public class SocketDevResponseService {
if (param.getTestItemList().get(2)) {
//如果后续做正式检测
PqScriptIssueParam issueParam = new PqScriptIssueParam();
SourceInitialize sourceInitialize = pqSourceService.getSourceInitializeParam(param.getSourceId());
issueParam.setSourceId(sourceInitialize.getSourceId());
issueParam.setPlanId(param.getPlanId());
issueParam.setSourceId(param.getSourceId());
issueParam.setDevIds(param.getDevIds());
@@ -893,10 +898,9 @@ public class SocketDevResponseService {
//开始下源控制脚本
PqScriptIssueParam issueParam = new PqScriptIssueParam();
SourceInitialize sourceInitialize = pqSourceService.getSourceInitializeParam(param.getSourceId());
issueParam.setSourceId(sourceInitialize.getSourceId());
issueParam.setPlanId(param.getPlanId());
issueParam.setSourceId(param.getSourceId());
issueParam.setDevIds(param.getDevIds());
issueParam.setScriptId(param.getScriptId());
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
List<SourceIssue> sourceIssues;
@@ -1162,8 +1166,9 @@ public class SocketDevResponseService {
} else if (param.getTestItemList().get(2)) {
// 后续做正式检测
PqScriptIssueParam issueParam = new PqScriptIssueParam();
SourceInitialize sourceInitialize = pqSourceService.getSourceInitializeParam(param.getSourceId());
issueParam.setSourceId(sourceInitialize.getSourceId());
issueParam.setPlanId(param.getPlanId());
issueParam.setSourceId(param.getSourceId());
issueParam.setDevIds(param.getDevIds());
issueParam.setScriptId(param.getScriptId());
@@ -1816,8 +1821,9 @@ public class SocketDevResponseService {
XiNumberManager.devParameterList.add(devParameterSmall);
PqScriptIssueParam issueParam = new PqScriptIssueParam();
SourceInitialize sourceInitialize = pqSourceService.getSourceInitializeParam(param.getSourceId());
issueParam.setSourceId(sourceInitialize.getSourceId());
issueParam.setPlanId(param.getPlanId());
issueParam.setSourceId(param.getSourceId());
issueParam.setDevIds(param.getDevIds());
issueParam.setScriptId(param.getScriptId());
issueParam.setIsPhaseSequence(CommonEnum.COEFFICIENT_TEST.getValue());

View File

@@ -275,6 +275,9 @@ public class SocketFreqConverterDevService {
if (DetectionCodeEnum.MAG.getCode().equalsIgnoreCase(sqlDataDTO.getDesc())) {
residualVoltage = value;
if (residualVoltage <= 6) {
return;
}
} else if (DetectionCodeEnum.DUR.getCode().equalsIgnoreCase(sqlDataDTO.getDesc())) {
durationMs = (int) Math.round(value * 1000);
}
@@ -314,6 +317,7 @@ public class SocketFreqConverterDevService {
: 0);
testRes.setDurationMs(pqDipData.getDurationMs());
testRes.setResidualVoltage(pqDipData.getResidualVoltage());
testRes.setTime(LocalDateTime.now());
FormalTestManager.pendingDipTaskMap.put(testRes.getId(), new FormalTestManager.PendingDipTask(
pqDipData,

View File

@@ -29,6 +29,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executors;
@@ -326,27 +327,33 @@ public class SocketFreqConverterService {
socketDataMsg.setData(JSON.toJSONString(newTolerantPointVO));
WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg));
if (ObjectUtil.isNotNull(this.lastTolerancePoint)) {
boolean isNewGroup = this.isNewGroup(this.lastTolerancePoint, newTolerantPointVO);
if (isNewGroup) {
// 纵向分组
if (freqConverterConfig.getDirection() == 1) {
if (this.lastTolerancePoint.getTolerant() == 1 && testRes.getTolerant() == 1) {
TolerantPointVO featurePointVO = new TolerantPointVO();
featurePointVO.setResidualVoltage(this.lastTolerancePoint.getResidualVoltage());
featurePointVO.setDurationMs(this.lastTolerancePoint.getDurationMs());
featurePointVO.setTolerant(2);
socketDataMsg.setData(JSON.toJSONString(featurePointVO));
WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg));
testRes.setTolerant(2);
}
}
} else {
if (this.lastTolerancePoint.getTolerant() == 1 && testRes.getTolerant() == 0) {
if (testRes.getTolerant() == 0) {
if (ObjectUtil.isNotNull(this.lastTolerancePoint) && this.lastTolerancePoint.getTolerant() == 1) {
TolerantPointVO featurePointVO = new TolerantPointVO();
featurePointVO.setResidualVoltage(Math.round((task.getPqDipData().getResidualVoltage() + this.lastTolerancePoint.getResidualVoltage()) / 2D * 100) / 100D);
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);
featureTestRes.setTime(LocalDateTime.now());
saveTestResList.add(featureTestRes);
}
// 从数据库按照列查询距离该暂降点最近的一个暂降点
if (freqConverterConfig.getDirection() == 0) {
PqFreqConverterTestRes lastByDuration = pqFreqConverterTestResService.getLastByDuration(suffix, key, task.getPqDipData().getDurationMs());
if (ObjectUtil.isNotNull(lastByDuration) && lastByDuration.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.setResidualVoltage(Math.round((task.getPqDipData().getResidualVoltage() + lastByDuration.getResidualVoltage()) / 2D * 100) / 100D);
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));
@@ -356,6 +363,28 @@ public class SocketFreqConverterService {
featureTestRes.setDurationMs(featurePointVO.getDurationMs());
featureTestRes.setResidualVoltage(featurePointVO.getResidualVoltage());
featureTestRes.setTolerant(2);
featureTestRes.setTime(LocalDateTime.now());
saveTestResList.add(featureTestRes);
}
}
// 从数据库按照行查询距离该暂降点最近的一个暂降点
if (freqConverterConfig.getDirection() == 1) {
PqFreqConverterTestRes lastByResidualVoltage = pqFreqConverterTestResService.getLastByResidualVoltage(suffix, key, task.getPqDipData().getResidualVoltage());
if (ObjectUtil.isNotNull(lastByResidualVoltage) && lastByResidualVoltage.getTolerant() == 1) {
TolerantPointVO featurePointVO = new TolerantPointVO();
featurePointVO.setResidualVoltage(Math.round((task.getPqDipData().getResidualVoltage() + lastByResidualVoltage.getResidualVoltage()) / 2D * 100) / 100D);
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);
featureTestRes.setTime(LocalDateTime.now());
saveTestResList.add(featureTestRes);
}
}
@@ -363,7 +392,6 @@ public class SocketFreqConverterService {
this.lastTolerancePoint = newTolerantPointVO;
updateTestResList.add(testRes);
}
});
if (!saveTestResList.isEmpty()) {

View File

@@ -289,7 +289,8 @@ public class PreDetectionServiceImpl implements PreDetectionService {
}
//组装源控制脚本
PqScriptIssueParam issueParam = new PqScriptIssueParam();
issueParam.setSourceId(param.getSourceId());
SourceInitialize sourceInitialize = pqSourceService.getSourceInitializeParam(param.getSourceId());
issueParam.setSourceId(sourceInitialize.getSourceId());
issueParam.setScriptId(param.getScriptId());
issueParam.setType(1);
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.SIMULATE_TEST.getValue());

View File

@@ -16,4 +16,6 @@ public class FreqConverterConfig {
private Integer tolerant;
private Integer dt;
private Integer direction;
private Integer allowErrorDuration;
private Double allowErrorResidualVoltage;
}

View File

@@ -1,6 +1,7 @@
package com.njcn.gather.freqConverter.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
@@ -31,4 +32,10 @@ public class PqFreqConverterTestRes {
* 0为不耐受1为耐受2为特性曲线点
*/
private Integer tolerant;
/**
* 时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
private LocalDateTime time;
}

View File

@@ -1,7 +1,10 @@
package com.njcn.gather.freqConverter.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author caozehui
* @data 2026-04-13
@@ -22,4 +25,10 @@ public class TolerantPointVO {
* 是否耐受。0-否1-是2-表示特性曲线点
*/
private Integer tolerant;
/**
* 时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
private LocalDateTime time;
}

View File

@@ -18,19 +18,10 @@ public interface IPqFreqConverterTestResService extends IService<PqFreqConverter
*/
void clearAllData(Integer suffix);
/**
* 保存结果记录
*
* @param suffix 表后缀
* @param testResList 结果数据
* @return 是否成功
*/
boolean saveOrUpdateTestRes(Integer suffix, List<PqFreqConverterTestRes> testResList);
/**
* 新增结果记录
*
* @param suffix 表后缀
* @param suffix 表后缀
* @param testResList 结果数据
* @return 是否成功
*/
@@ -39,7 +30,7 @@ public interface IPqFreqConverterTestResService extends IService<PqFreqConverter
/**
* 更新结果记录
*
* @param suffix 表后缀
* @param suffix 表后缀
* @param testResList 结果数据
* @return 是否成功
*/
@@ -53,4 +44,7 @@ public interface IPqFreqConverterTestResService extends IService<PqFreqConverter
*/
List<PqFreqConverterTestRes> listTestRes(Integer suffix);
PqFreqConverterTestRes getLastByDuration(Integer suffix, String id, Integer durationMs);
PqFreqConverterTestRes getLastByResidualVoltage(Integer suffix, String id, Double residualVoltage);
}

View File

@@ -83,6 +83,7 @@ public class FreqConverterServiceImpl extends ServiceImpl<FreqConverterStatusMap
tolerantPointVO.setDurationMs(item.getDurationMs());
tolerantPointVO.setResidualVoltage(item.getResidualVoltage());
tolerantPointVO.setTolerant(item.getTolerant());
tolerantPointVO.setTime(item.getTime());
return tolerantPointVO;
})
.sorted(Comparator.comparingInt(TolerantPointVO::getDurationMs))

View File

@@ -84,6 +84,7 @@ public class PqFreqConverterConfigServiceImpl extends ServiceImpl<PqFreqConverte
" `residual_voltage` decimal(6,2) NOT NULL COMMENT '残余电压(%Ur)'," +
" `duration_ms` int(11) NOT NULL COMMENT '持续时间(ms)'," +
" `tolerant` tinyInt(1) NOT NULL COMMENT '0为不耐受1为耐受2为特征点'," +
" `time` datetime(3) DEFAULT NULL COMMENT '时间',"+
" PRIMARY KEY (`id`)" +
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='变频器耐受实验结果';";
tableGenMapper.genTable(tableSql);

View File

@@ -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);
@@ -22,10 +28,6 @@ public class PqFreqConverterTestResServiceImpl extends ServiceImpl<PqFreqConvert
DynamicTableNameHandler.remove();
}
@Override
public boolean saveOrUpdateTestRes(Integer suffix, List<PqFreqConverterTestRes> testResList) {
return this.updateTestRes(suffix, testResList);
}
@Override
public boolean saveTestRes(Integer suffix, List<PqFreqConverterTestRes> testResList) {
@@ -51,4 +53,29 @@ public class PqFreqConverterTestResServiceImpl extends ServiceImpl<PqFreqConvert
return result;
}
@Override
public PqFreqConverterTestRes getLastByDuration(Integer suffix, String id, 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())
.ne(PqFreqConverterTestRes::getId, id)
.orderByAsc(PqFreqConverterTestRes::getResidualVoltage)
.last("limit 1");
PqFreqConverterTestRes result = this.getOne(queryWrapper);
DynamicTableNameHandler.remove();
return result;
}
@Override
public PqFreqConverterTestRes getLastByResidualVoltage(Integer suffix, String id, 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.getAllowErrorResidualVoltage())
.ne(PqFreqConverterTestRes::getId, id)
.orderByDesc(PqFreqConverterTestRes::getDurationMs)
.last("limit 1");
PqFreqConverterTestRes result = this.getOne(queryWrapper);
DynamicTableNameHandler.remove();
return result;
}
}

View File

@@ -34,6 +34,8 @@ import com.njcn.gather.script.service.IPqScriptCheckDataService;
import com.njcn.gather.script.service.IPqScriptDtlsService;
import com.njcn.gather.script.util.ScriptDtlsDesc;
import com.njcn.gather.script.util.ThreePhaseUnbalance;
import com.njcn.gather.source.pojo.po.SourceInitialize;
import com.njcn.gather.source.service.IPqSourceService;
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
import com.njcn.gather.system.dictionary.service.IDictTreeService;
import com.njcn.gather.system.pojo.enums.DicDataEnum;
@@ -68,13 +70,13 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
private final static String INHARM_I = "InHarm_I";
private final static String DIP = "Dip";
private final static String FLICKER = "Flicker";
// @Value("${Dip.fPreTime}")
// @Value("${Dip.fPreTime}")
// private Double fPreTime;
@Value("${Dip.fRampIn}")
private Double fRampIn;
@Value("${Dip.fRampOut}")
private Double fRampOut;
// @Value("${Dip.fAfterTime}")
// @Value("${Dip.fAfterTime}")
// private Double fAfterTime;
@Value("${Flicker.waveFluType}")
private String waveFluType;
@@ -91,6 +93,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
private final IDevTypeService devTypeService;
private final IDictTreeService dictTreeService;
private final AdPlanMapper adPlanMapper;
private final IPqSourceService pqSourceService;
@Override
@Transactional
@@ -781,7 +784,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
@Override
public Set<String> getScriptToIcdCheckInfo(PreDetectionParam param) {
PqScriptIssueParam issueParam = new PqScriptIssueParam();
issueParam.setSourceId(param.getSourceId());
SourceInitialize sourceInitialize = pqSourceService.getSourceInitializeParam(param.getSourceId());
issueParam.setSourceId(sourceInitialize.getSourceId());
issueParam.setDevIds(param.getDevIds());
issueParam.setScriptId(param.getScriptId());
issueParam.setIsPhaseSequence(CommonEnum.FORMAL_TEST.getValue());
@@ -974,7 +978,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
for (int i = 0; i < pqScriptDtls.size(); i++) {
PqScriptDtls scriptDtls = pqScriptDtls.get(i);
// 注意此处scriptDtls.getValue() < 1.0,考虑到有些已经投入运行的地方,可能没有改库,避免不必要的异常
if(scriptDtls.getValueType().equalsIgnoreCase("CUR") && scriptDtls.getValue() < 1.0){
if (scriptDtls.getValueType().equalsIgnoreCase("CUR") && scriptDtls.getValue() < 1.0) {
scriptDtls.setValue(devCurr * scriptDtls.getValue());
}
}

View File

@@ -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: 0 #0为横向1为纵向
allow-error-duration: 6 #暂态持续时间允许最大误差ms
allow-error-residual-voltage: 2.0 #暂态幅值允许最多误差%