1.添加相角启用配置和逻辑处理
2.修正数据处理逻辑以支持相角启用配置
This commit is contained in:
@@ -35,6 +35,7 @@ import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
||||
import com.njcn.gather.system.reg.service.ISysRegResService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@@ -81,7 +82,8 @@ public class SocketDevResponseService {
|
||||
private final ISysTestConfigService sysTestConfigService;
|
||||
private final AdHarmonicService adHarmonicService;
|
||||
private final IAdPlanService adPlanService;
|
||||
|
||||
@Value("${phaseAngle.isEnable}")
|
||||
private Boolean isPhaseAngle;
|
||||
|
||||
// private final ExecutorService executorPool = Executors.newFixedThreadPool(10);
|
||||
|
||||
@@ -563,12 +565,12 @@ public class SocketDevResponseService {
|
||||
coefficientVO.setCIeData(String.valueOf(optionalIC));
|
||||
|
||||
if (XiNumberManager.stepNumber == 0 || XiNumberManager.stepNumber == 1) {
|
||||
Integer aXi = BigDecimal.valueOf(devParameter.getDevVolt() * startF.getF().getUa_gain() / optionalA).setScale(0,RoundingMode.HALF_UP).intValue();
|
||||
Integer bXi = BigDecimal.valueOf(devParameter.getDevVolt() * startF.getF().getUb_gain() / optionalB).setScale(0,RoundingMode.HALF_UP).intValue();
|
||||
Integer cXi = BigDecimal.valueOf(devParameter.getDevVolt() * startF.getF().getUc_gain() / optionalC).setScale(0,RoundingMode.HALF_UP).intValue();
|
||||
Integer aIXi =BigDecimal.valueOf(devParameter.getDevCurr() * startF.getF().getIa_gain() / optionalIA).setScale(0,RoundingMode.HALF_UP).intValue();
|
||||
Integer bIXi =BigDecimal.valueOf(devParameter.getDevCurr() * startF.getF().getIb_gain() / optionalIB).setScale(0,RoundingMode.HALF_UP).intValue();
|
||||
Integer cIXi =BigDecimal.valueOf(devParameter.getDevCurr() * startF.getF().getIc_gain() / optionalIC).setScale(0,RoundingMode.HALF_UP).intValue();
|
||||
Integer aXi = BigDecimal.valueOf(devParameter.getDevVolt() * startF.getF().getUa_gain() / optionalA).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||
Integer bXi = BigDecimal.valueOf(devParameter.getDevVolt() * startF.getF().getUb_gain() / optionalB).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||
Integer cXi = BigDecimal.valueOf(devParameter.getDevVolt() * startF.getF().getUc_gain() / optionalC).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||
Integer aIXi = BigDecimal.valueOf(devParameter.getDevCurr() * startF.getF().getIa_gain() / optionalIA).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||
Integer bIXi = BigDecimal.valueOf(devParameter.getDevCurr() * startF.getF().getIb_gain() / optionalIB).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||
Integer cIXi = BigDecimal.valueOf(devParameter.getDevCurr() * startF.getF().getIc_gain() / optionalIC).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||
|
||||
coefficientVO.setAVuXi(aXi.toString());
|
||||
coefficientVO.setBVuXi(bXi.toString());
|
||||
@@ -1285,13 +1287,22 @@ public class SocketDevResponseService {
|
||||
List<DevData.SqlDataDTO> data,
|
||||
List<DevData.SqlDataDTO> dataPhase) {
|
||||
StringBuffer str = new StringBuffer();
|
||||
if (data.size() == dataPhase.size()) {
|
||||
if(isPhaseAngle){
|
||||
if(CollUtil.isNotEmpty(data)&&CollUtil.isNotEmpty(dataPhase)){
|
||||
if (data.size() == dataPhase.size()) {
|
||||
DevData.SqlDataDTO.ListDTO dto = data.get(0).getList();
|
||||
DevData.SqlDataDTO.ListDTO phase = dataPhase.get(0).getList();
|
||||
str.append("装置(" + type + "a=" + String.format("%.4f", dto.getA()) + ",相角=" + String.format("%.4f", phase.getA()) + "° " +
|
||||
type + "b=" + String.format("%.4f", dto.getB()) + ",相角=" + String.format("%.4f", phase.getB()) + "° " +
|
||||
type + "c=" + String.format("%.4f", dto.getC()) + ",相角=" + String.format("%.4f", phase.getC()) + "° ");
|
||||
str.append(")");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
DevData.SqlDataDTO.ListDTO dto = data.get(0).getList();
|
||||
DevData.SqlDataDTO.ListDTO phase = dataPhase.get(0).getList();
|
||||
|
||||
str.append("装置(" + type + "a=" + String.format("%.4f", dto.getA()) + ",相角=" + String.format("%.4f", phase.getA()) + "° " +
|
||||
type + "b=" + String.format("%.4f", dto.getB()) + ",相角=" + String.format("%.4f", phase.getB()) + "° " +
|
||||
type + "c=" + String.format("%.4f", dto.getC()) + ",相角=" + String.format("%.4f", phase.getC()) + "° ");
|
||||
str.append("装置(" + type + "a=" + String.format("%.4f", dto.getA()) +
|
||||
type + "b=" + String.format("%.4f", dto.getB()) +
|
||||
type + "c=" + String.format("%.4f", dto.getC()) );
|
||||
str.append(")");
|
||||
}
|
||||
return str.toString();
|
||||
@@ -1366,20 +1377,33 @@ public class SocketDevResponseService {
|
||||
//源信息
|
||||
Map<String, SourceIssue.ChannelListDTO> sourceMap = channelList.stream()
|
||||
.collect(Collectors.toMap(x -> x.getChannelType(), Function.identity()));
|
||||
Boolean a = getaBoolean(sourceMap.get(type + "a"), data.get(0).getList().getA(), dataPhase.get(0).getList().getA());
|
||||
Boolean b = getaBoolean(sourceMap.get(type + "b"), data.get(0).getList().getB(), dataPhase.get(0).getList().getB());
|
||||
Boolean c = getaBoolean(sourceMap.get(type + "c"), data.get(0).getList().getC(), dataPhase.get(0).getList().getC());
|
||||
Boolean a = getaBoolean(sourceMap.get(type + "a"), CollUtil.isNotEmpty(data) ? data.get(0).getList().getA() : null,
|
||||
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getA(): null);
|
||||
Boolean b = getaBoolean(sourceMap.get(type + "b"), CollUtil.isNotEmpty(data) ? data.get(0).getList().getB(): null,
|
||||
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getB(): null);
|
||||
Boolean c = getaBoolean(sourceMap.get(type + "c"), CollUtil.isNotEmpty(data) ? data.get(0).getList().getC(): null,
|
||||
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getC(): null);
|
||||
compareDev.setIsQualified(a && b && c);
|
||||
compareDev.setDesc(name + (compareDev.getIsQualified() ? "合格->" : "不合格->") + stepTag + desc + stepTag + devMessage(type, data, dataPhase));
|
||||
return compareDev;
|
||||
}
|
||||
|
||||
private static Boolean getaBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devData, Double devPhase) {
|
||||
return NumberUtil.isIn(BigDecimal.valueOf(devData),
|
||||
BigDecimal.valueOf(channelListDTO.getFAmp() * 0.95),
|
||||
BigDecimal.valueOf(channelListDTO.getFAmp() * 1.05))
|
||||
&&
|
||||
phaseBoolean(channelListDTO, devPhase);
|
||||
private Boolean getaBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devData, Double devPhase) {
|
||||
Boolean isDev = false;
|
||||
Boolean isPhase = false;
|
||||
if(ObjectUtil.isNotNull(devData)){
|
||||
isDev= NumberUtil.isIn(BigDecimal.valueOf(devData),
|
||||
BigDecimal.valueOf(channelListDTO.getFAmp() * 0.95),
|
||||
BigDecimal.valueOf(channelListDTO.getFAmp() * 1.05));
|
||||
}
|
||||
if(isPhaseAngle){
|
||||
if(ObjectUtil.isNotNull(devPhase)){
|
||||
isPhase = phaseBoolean(channelListDTO, devPhase);
|
||||
}
|
||||
}else{
|
||||
isPhase=true;
|
||||
}
|
||||
return isDev && isPhase;
|
||||
|
||||
}
|
||||
|
||||
@@ -1391,7 +1415,7 @@ public class SocketDevResponseService {
|
||||
* @param devPhase 装置返回角度
|
||||
* @return
|
||||
*/
|
||||
private static Boolean phaseBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devPhase) {
|
||||
private Boolean phaseBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devPhase) {
|
||||
Double phase = devPhase;
|
||||
if (devPhase < -180) {
|
||||
phase = devPhase + 360;
|
||||
@@ -1603,8 +1627,8 @@ public class SocketDevResponseService {
|
||||
List<String> c = tem.getC();
|
||||
|
||||
Class<AdHarmonicResult> example = (Class<AdHarmonicResult>) adHarmonicResult.getClass();
|
||||
if(DicDataEnum.HSV.getCode().equals(sourceIssue.getType()) || DicDataEnum.HSI.getCode().equals(sourceIssue.getType())){
|
||||
for (int i = 1; i < a.size()+1; i++) {
|
||||
if (DicDataEnum.HSV.getCode().equals(sourceIssue.getType()) || DicDataEnum.HSI.getCode().equals(sourceIssue.getType())) {
|
||||
for (int i = 1; i < a.size() + 1; i++) {
|
||||
try {
|
||||
Field aField = example.getDeclaredField("aValue" + i);
|
||||
Field bField = example.getDeclaredField("bValue" + i);
|
||||
@@ -1620,8 +1644,8 @@ public class SocketDevResponseService {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for (int i = 2; i <= a.size()+1; i++) {
|
||||
} else {
|
||||
for (int i = 2; i <= a.size() + 1; i++) {
|
||||
try {
|
||||
Field aField = example.getDeclaredField("aValue" + i);
|
||||
Field bField = example.getDeclaredField("bValue" + i);
|
||||
|
||||
@@ -9,6 +9,9 @@ spring:
|
||||
url: jdbc:mysql://192.168.1.24:13306/pqs91001?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
||||
username: root
|
||||
password: njcnpqs
|
||||
# url: jdbc:mysql://localhost:3306/pqs91001?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
||||
# username: root
|
||||
# password: root
|
||||
#初始化建立物理连接的个数、最小、最大连接数
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
@@ -41,15 +44,22 @@ mybatis-plus:
|
||||
#指定主键生成策略
|
||||
id-type: assign_uuid
|
||||
|
||||
|
||||
phaseAngle:
|
||||
isEnable: false
|
||||
|
||||
socket:
|
||||
source:
|
||||
ip: 192.168.1.24
|
||||
ip: 192.168.1.138
|
||||
port: 62000
|
||||
device:
|
||||
ip: 192.168.1.24
|
||||
ip: 192.168.1.138
|
||||
port: 61000
|
||||
# source:
|
||||
# ip: 192.168.1.121
|
||||
# port: 10086
|
||||
# device:
|
||||
# ip: 192.168.1.121
|
||||
# port: 61000
|
||||
|
||||
webSocket:
|
||||
port: 7777
|
||||
|
||||
Reference in New Issue
Block a user