|
@@ -15,10 +15,7 @@ import com.bizmatics.common.mvc.base.AbstractCrudService;
|
|
|
import com.bizmatics.common.spring.util.GlobalUtils;
|
|
|
import com.bizmatics.common.spring.util.JsonUtils;
|
|
|
import com.bizmatics.model.*;
|
|
|
-import com.bizmatics.model.vo.DataManagementOneVO;
|
|
|
-import com.bizmatics.model.vo.DataManagementVO;
|
|
|
-import com.bizmatics.model.vo.HtAnalogDataOneVo;
|
|
|
-import com.bizmatics.model.vo.HtAnalogDataVo;
|
|
|
+import com.bizmatics.model.vo.*;
|
|
|
import com.bizmatics.persistence.mapper.HtAnalogDataMapper;
|
|
|
import com.bizmatics.service.*;
|
|
|
import com.bizmatics.service.util.FieldEscapeUtils;
|
|
@@ -33,8 +30,13 @@ import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.DateFormat;
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
|
+
|
|
|
+import static com.bizmatics.service.impl.RtAnalogDataServiceImpl.getLastDayOfMonth;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -194,25 +196,29 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
|
|
|
@Override
|
|
|
public TimeShareVO getTimeShare(Integer siteId, Integer type) {
|
|
|
- TimeShareVO timeShareVO = new TimeShareVO();
|
|
|
+ AtomicReference<TimeShareVO> timeShareVO = new AtomicReference<>(new TimeShareVO());
|
|
|
Date date = new Date();
|
|
|
if (0 == type) {
|
|
|
- HadSiteStatic hadSiteStatic = hadSiteStaticService.oneBySite(siteId, date, date);
|
|
|
- Optional.ofNullable(hadSiteStatic).ifPresent(hads -> JsonUtils.fromJson(hads.getTimeShare(), timeShareVO.getClass()));
|
|
|
+ Date yeDay = DateUtils.addDays(date, -1);
|
|
|
+ Date yeStartDay = DateUtils.getDayStartTime(yeDay);
|
|
|
+ HadSiteStatic hadSiteStatic = hadSiteStaticService.oneBySite(siteId, yeStartDay, yeDay);
|
|
|
+ Optional.ofNullable(hadSiteStatic).ifPresent(hads -> {
|
|
|
+ timeShareVO.set(JsonUtils.fromJson(hads.getTimeShare(), TimeShareVO.class));
|
|
|
+ });
|
|
|
} else {
|
|
|
List<HadSiteStatic> list = hadSiteStaticService.list(siteId, DateUtils.getFirstDayOfMonth(date), date);
|
|
|
for (HadSiteStatic hadSiteStatic : list) {
|
|
|
Optional.ofNullable(hadSiteStatic.getTimeShare())
|
|
|
.ifPresent(has -> {
|
|
|
TimeShareVO ts = JsonUtils.fromJson(has, TimeShareVO.class);
|
|
|
- timeShareVO.setFlat(Arith.add(timeShareVO.getFlat(), ts.getFlat()));
|
|
|
- timeShareVO.setPeak(Arith.add(timeShareVO.getPeak(), ts.getPeak()));
|
|
|
- timeShareVO.setNeed(Arith.add(timeShareVO.getNeed(), ts.getNeed()));
|
|
|
- timeShareVO.setGrain(Arith.add(timeShareVO.getGrain(), ts.getGrain()));
|
|
|
+ timeShareVO.get().setFlat(Arith.add(timeShareVO.get().getFlat(), ts.getFlat()));
|
|
|
+ timeShareVO.get().setPeak(Arith.add(timeShareVO.get().getPeak(), ts.getPeak()));
|
|
|
+ timeShareVO.get().setNeed(Arith.add(timeShareVO.get().getNeed(), ts.getNeed()));
|
|
|
+ timeShareVO.get().setGrain(Arith.add(timeShareVO.get().getGrain(), ts.getGrain()));
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- return timeShareVO;
|
|
|
+ return timeShareVO.get();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -597,6 +603,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
|
|
|
@Override
|
|
|
public String monthlyReportExport(String deviceCode, String startTime, String endTime, int cycle) {
|
|
|
+ DateFormat dFormat = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
|
|
|
Workbook workbook = null;
|
|
|
File file = null;
|
|
|
try {
|
|
@@ -608,7 +615,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
return new ArrayList<>(BeanMapperUtils.mapList(listOne, HtAnalogDataOneVo.class, HtAnalogDataTwoExportVo.class));
|
|
|
}, null);
|
|
|
if (null != workbook) {
|
|
|
- file = FileUtils.getFile(GlobalUtils.getTempBaseDir(), String.format("%s-%s.xlsx", "用能月报", System.currentTimeMillis() + ""));
|
|
|
+ file = FileUtils.getFile(GlobalUtils.getTempBaseDir(), String.format("%s-%s.xlsx", "用能月报", dFormat.format(System.currentTimeMillis()) + ""));
|
|
|
FileUtils.createFile(file.getAbsolutePath());
|
|
|
FileOutputStream allListingFileOutputStream = new FileOutputStream(file);
|
|
|
workbook.write(allListingFileOutputStream);
|
|
@@ -656,4 +663,415 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
return listOne;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public SingleLoopReportOneVo SingleLoopReportData(String deviceCode, Date time, int type){
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM");
|
|
|
+ String startTime = null;
|
|
|
+ String endtime = null;
|
|
|
+ if (type == 1) {
|
|
|
+ startTime = sdf.format(time) + " 00:00:00";
|
|
|
+ endtime = sdf.format(time) + " 23:59:59";
|
|
|
+ } else {
|
|
|
+ startTime = sdf1.format(time) + "-01 00:00:00";
|
|
|
+ String time1 = sdf1.format(time) + "-01";
|
|
|
+ try {
|
|
|
+ Date yq = getLastDayOfMonth(sdf.parse(time1));
|
|
|
+ endtime = sdf.format(yq) + " 23:59:59";
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BusinessException("时间错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<SingleLoopReportVo> SingleLoopReportList = baseMapper.SingleLoopReportData(deviceCode,startTime,endtime);
|
|
|
+ if (CollectionUtils.isEmpty(SingleLoopReportList)){
|
|
|
+ SingleLoopReportOneVo singleLoopReportOneVo = null;
|
|
|
+ return singleLoopReportOneVo;
|
|
|
+// throw new BusinessException("暂无数据");
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<HtAnalogData> adQuery = Wrappers.lambdaQuery();
|
|
|
+ adQuery.eq(HtAnalogData::getDeviceName, deviceCode)
|
|
|
+ .between(HtAnalogData::getDataTime, startTime, endtime);
|
|
|
+ List<HtAnalogData> RtAnalogDataList = this.list(adQuery);
|
|
|
+ if (CollectionUtils.isEmpty(RtAnalogDataList)) {
|
|
|
+ throw new BusinessException("da不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return analysisCalculation(SingleLoopReportList,RtAnalogDataList);
|
|
|
+ }
|
|
|
+
|
|
|
+ public SingleLoopReportOneVo analysisCalculation(List<SingleLoopReportVo> SingleLoopReportList,List<HtAnalogData> RtAnalogDataList){
|
|
|
+ DecimalFormat df = new DecimalFormat("######0.00");
|
|
|
+ List<Double> checkList = new ArrayList<>();
|
|
|
+ SingleLoopReportOneVo singleLoopReportOneVo = BeanMapperUtils.map(SingleLoopReportList.get(0), SingleLoopReportOneVo.class);
|
|
|
+
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getAvgIa());
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getAvgIb());
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getAvgIc());
|
|
|
+ //电流不平衡(平均)
|
|
|
+ Double AvgElBalun = checkBalun(checkList) * 100;
|
|
|
+ singleLoopReportOneVo.setAvgElBalun(Double.valueOf(df.format(AvgElBalun)));
|
|
|
+ if (AvgElBalun<15){
|
|
|
+ singleLoopReportOneVo.setAvgElBalunStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setAvgElBalunStatus(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMaxIa());
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMaxIb());
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMaxIc());
|
|
|
+ //电流不平衡(最大)
|
|
|
+ Double MaxElBalun = checkBalun(checkList) * 100;
|
|
|
+ singleLoopReportOneVo.setMaxElBalun(Double.valueOf(df.format(MaxElBalun)));
|
|
|
+ if (MaxElBalun<15){
|
|
|
+ singleLoopReportOneVo.setMaxElBalunStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setMaxElBalunStatus(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMinIa());
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMinIb());
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMinIc());
|
|
|
+ //电流不平衡(最小)
|
|
|
+ Double MinElBalun = checkBalun(checkList) * 100;
|
|
|
+ singleLoopReportOneVo.setMinElBalun(Double.valueOf(df.format(MinElBalun)));
|
|
|
+ if (MinElBalun<15){
|
|
|
+ singleLoopReportOneVo.setMinElBalunStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setMinElBalunStatus(false);
|
|
|
+ }
|
|
|
+ if (AvgElBalun<15&&MaxElBalun<15&&MinElBalun<15){
|
|
|
+ singleLoopReportOneVo.setElBalunStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setElBalunStatus(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getAvgUa());
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getAvgUb());
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getAvgUc());
|
|
|
+ //电压不平衡(平均)
|
|
|
+ Double AvgVtBalun = checkBalun(checkList) * 100;
|
|
|
+ singleLoopReportOneVo.setAvgVtBalun(Double.valueOf(df.format(AvgVtBalun)));
|
|
|
+ if (AvgVtBalun<15){
|
|
|
+ singleLoopReportOneVo.setAvgVtBalunStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setAvgVtBalunStatus(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMaxUa());
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMaxUb());
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMaxUc());
|
|
|
+ //电压不平衡(最大)
|
|
|
+ Double MaxVtBalun = checkBalun(checkList) * 100;
|
|
|
+ singleLoopReportOneVo.setMaxVtBalun(Double.valueOf(df.format(MaxVtBalun)));
|
|
|
+ if (MaxVtBalun<15){
|
|
|
+ singleLoopReportOneVo.setMaxVtBalunStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setMaxVtBalunStatus(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMinUa());
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMinUb());
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMinUc());
|
|
|
+ //电压不平衡(最小)
|
|
|
+ Double MinVtBalun = checkBalun(checkList) * 100;
|
|
|
+ singleLoopReportOneVo.setMinVtBalun(Double.valueOf(df.format(MinVtBalun)));
|
|
|
+ if (MinVtBalun<15){
|
|
|
+ singleLoopReportOneVo.setMinVtBalunStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setMinVtBalunStatus(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (AvgVtBalun<15&&MaxVtBalun<15&&MinVtBalun<15){
|
|
|
+ singleLoopReportOneVo.setVtBalunStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setVtBalunStatus(false);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ double voltageLevel = Double.parseDouble(singleLoopReportOneVo.getVoltageLevel());
|
|
|
+ double voltageLevelWanting = voltageLevel / 100 * 7;
|
|
|
+
|
|
|
+ //A相电压合格率(平均)
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getAvgUa());
|
|
|
+ checkList.add(voltageLevel);
|
|
|
+ Double AvgUaQR = Double.valueOf(df.format(VoltageQr(checkList,voltageLevel)));
|
|
|
+ singleLoopReportOneVo.setAvgUa(df.format(SingleLoopReportList.get(0).getAvgUa())+"kV("+AvgUaQR+"%)");
|
|
|
+ if (AvgUaQR<7.00){
|
|
|
+ singleLoopReportOneVo.setAvgUaStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setAvgUaStatus(false);
|
|
|
+ }
|
|
|
+ //B相电压合格率(平均)
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getAvgUb());
|
|
|
+ checkList.add(voltageLevel);
|
|
|
+ Double AvgUbQR = Double.valueOf(df.format(VoltageQr(checkList,voltageLevel)));
|
|
|
+ singleLoopReportOneVo.setAvgUb(df.format(SingleLoopReportList.get(0).getAvgUb())+"kV("+AvgUbQR+"%)");
|
|
|
+ if (AvgUbQR<7.00){
|
|
|
+ singleLoopReportOneVo.setAvgUbStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setAvgUbStatus(false);
|
|
|
+ }
|
|
|
+ //C相电压合格率(平均)
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getAvgUc());
|
|
|
+ checkList.add(voltageLevel);
|
|
|
+ Double AvgUcQR = Double.valueOf(df.format(VoltageQr(checkList,voltageLevel)));
|
|
|
+ singleLoopReportOneVo.setAvgUc(df.format(SingleLoopReportList.get(0).getAvgUc())+"kV("+AvgUcQR+"%)");
|
|
|
+ if (AvgUcQR<7.00){
|
|
|
+ singleLoopReportOneVo.setAvgUcStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setAvgUcStatus(false);
|
|
|
+ }
|
|
|
+ //A相电压合格率(最大)
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMaxUa());
|
|
|
+ checkList.add(voltageLevel);
|
|
|
+ Double MaxUaQR = Double.valueOf(df.format(VoltageQr(checkList,voltageLevel)));
|
|
|
+ singleLoopReportOneVo.setMaxUa(df.format(SingleLoopReportList.get(0).getMaxUa())+"kV("+MaxUaQR+"%)");
|
|
|
+ if (MaxUaQR<7.00){
|
|
|
+ singleLoopReportOneVo.setMaxUaStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setMaxUaStatus(false);
|
|
|
+ }
|
|
|
+ //B相电压合格率(最大)
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMaxUb());
|
|
|
+ checkList.add(voltageLevel);
|
|
|
+ Double MaxUbQR = Double.valueOf(df.format(VoltageQr(checkList,voltageLevel)));
|
|
|
+ singleLoopReportOneVo.setMaxUb(df.format(SingleLoopReportList.get(0).getMaxUb())+"kV("+MaxUbQR+"%)");
|
|
|
+ if (MaxUbQR<7.00){
|
|
|
+ singleLoopReportOneVo.setMaxUbStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setMaxUbStatus(false);
|
|
|
+ }
|
|
|
+ //C相电压合格率(最大)
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMaxUc());
|
|
|
+ checkList.add(voltageLevel);
|
|
|
+ Double MaxUcQR = Double.valueOf(df.format(VoltageQr(checkList,voltageLevel)));
|
|
|
+ singleLoopReportOneVo.setMaxUc(df.format(SingleLoopReportList.get(0).getMaxUc())+"kV("+MaxUcQR+"%)");
|
|
|
+ if (MaxUcQR<7.00){
|
|
|
+ singleLoopReportOneVo.setMaxUcStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setMaxUcStatus(false);
|
|
|
+ }
|
|
|
+ //A相电压合格率(最小)
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMinUa());
|
|
|
+ checkList.add(voltageLevel);
|
|
|
+ Double MinUaQR = Double.valueOf(df.format(VoltageQr(checkList,voltageLevel)));
|
|
|
+ singleLoopReportOneVo.setMinUa(df.format(SingleLoopReportList.get(0).getMinUa())+"kV("+MinUaQR+"%)");
|
|
|
+ if (MinUaQR<7.00){
|
|
|
+ singleLoopReportOneVo.setMinUaStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setMinUaStatus(false);
|
|
|
+ }
|
|
|
+ //B相电压合格率(最小)
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMinUb());
|
|
|
+ checkList.add(voltageLevel);
|
|
|
+ Double MinUbQR = Double.valueOf(df.format(VoltageQr(checkList,voltageLevel)));
|
|
|
+ singleLoopReportOneVo.setMinUb(df.format(SingleLoopReportList.get(0).getMinUb())+"kV("+MinUbQR+"%)");
|
|
|
+ if (MinUbQR<7.00){
|
|
|
+ singleLoopReportOneVo.setMinUbStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setMinUbStatus(false);
|
|
|
+ }
|
|
|
+ //C相电压合格率(最小)
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(SingleLoopReportList.get(0).getMinUc());
|
|
|
+ checkList.add(voltageLevel);
|
|
|
+ Double MinUcQR = Double.valueOf(df.format(VoltageQr(checkList,voltageLevel)));
|
|
|
+ singleLoopReportOneVo.setMinUc(df.format(SingleLoopReportList.get(0).getMinUc())+"kV("+MinUcQR+"%)");
|
|
|
+ if (MinUcQR<7.00){
|
|
|
+ singleLoopReportOneVo.setMinUcStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setMinUcStatus(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (AvgUaQR<7.00&&MaxUaQR<7.00&&MinUaQR<7.00){
|
|
|
+ singleLoopReportOneVo.setUaStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setUaStatus(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (AvgUbQR<7.00&&MaxUbQR<7.00&&MinUbQR<7.00){
|
|
|
+ singleLoopReportOneVo.setUbStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setUbStatus(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (AvgUcQR<7.00&&MaxUcQR<7.00&&MinUcQR<7.00){
|
|
|
+ singleLoopReportOneVo.setUcStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setUcStatus(false);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //频率(平均)
|
|
|
+ Double cAvgF = 0.00;
|
|
|
+ if (SingleLoopReportList.get(0).getAvgF()>=50){
|
|
|
+ cAvgF = Double.valueOf(df.format(SingleLoopReportList.get(0).getAvgF()-50.00));
|
|
|
+ }else {
|
|
|
+ cAvgF = Double.valueOf(df.format(50.00 - SingleLoopReportList.get(0).getAvgF()));
|
|
|
+ }
|
|
|
+ singleLoopReportOneVo.setAvgF(df.format(SingleLoopReportList.get(0).getAvgF())+"Hz("+cAvgF+"Hz)");
|
|
|
+ if (SingleLoopReportList.get(0).getAvgF()<50.2&&SingleLoopReportList.get(0).getAvgF()>49.8){
|
|
|
+ singleLoopReportOneVo.setAvgFStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setAvgFStatus(false);
|
|
|
+ }
|
|
|
+ //频率(最大)
|
|
|
+ Double cMaxF = 0.00;
|
|
|
+ if (SingleLoopReportList.get(0).getAvgF()>=50){
|
|
|
+ cMaxF = Double.valueOf(df.format( SingleLoopReportList.get(0).getMaxF()-50.00));
|
|
|
+ }else {
|
|
|
+ cMaxF = Double.valueOf(df.format(50.00 - SingleLoopReportList.get(0).getMaxF()));
|
|
|
+ }
|
|
|
+ singleLoopReportOneVo.setMaxF(df.format(SingleLoopReportList.get(0).getMaxF())+"Hz("+cMaxF+"Hz)");
|
|
|
+ if (SingleLoopReportList.get(0).getMaxF()<50.2&&SingleLoopReportList.get(0).getMaxF()>49.8){
|
|
|
+ singleLoopReportOneVo.setMaxFStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setMaxFStatus(false);
|
|
|
+ }
|
|
|
+ //频率(最小)
|
|
|
+ Double cMinF = 0.00;
|
|
|
+ if (SingleLoopReportList.get(0).getAvgF()>=50){
|
|
|
+ cMinF = Double.valueOf(df.format(SingleLoopReportList.get(0).getMinF()-50.00));
|
|
|
+ }else {
|
|
|
+ cMinF = Double.valueOf(df.format(50.00 - SingleLoopReportList.get(0).getMinF()));
|
|
|
+ }
|
|
|
+
|
|
|
+ singleLoopReportOneVo.setMinF(df.format(SingleLoopReportList.get(0).getMinF())+"Hz("+cMinF+"Hz)");
|
|
|
+ if (SingleLoopReportList.get(0).getMinF()<50.2&&SingleLoopReportList.get(0).getMinF()>49.8){
|
|
|
+ singleLoopReportOneVo.setMinFStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setMinFStatus(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (singleLoopReportOneVo.getAvgFStatus()==true&&singleLoopReportOneVo.getMaxFStatus()==true&&singleLoopReportOneVo.getMaxFStatus()==true){
|
|
|
+ singleLoopReportOneVo.setFStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setFStatus(false);
|
|
|
+ }
|
|
|
+ if (SingleLoopReportList.get(0).getCos()>0.85){
|
|
|
+ singleLoopReportOneVo.setCosStatus(true);
|
|
|
+ }else {
|
|
|
+ singleLoopReportOneVo.setCosStatus(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ int OverrunUa = 0;
|
|
|
+ int OverrunUb = 0;
|
|
|
+ int OverrunUc = 0;
|
|
|
+ int OverrunF = 0;
|
|
|
+ int OverrunElBalun = 0;
|
|
|
+ int OverrunVtBalun = 0;
|
|
|
+ if (RtAnalogDataList.size()>0){
|
|
|
+ for (int i=0;i<RtAnalogDataList.size();i++){
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(RtAnalogDataList.get(i).getUa());
|
|
|
+ checkList.add(voltageLevel);
|
|
|
+ Double maxUa = checkList.stream().max(Double::compareTo).get();
|
|
|
+ Double minUa = checkList.stream().min(Double::compareTo).get();
|
|
|
+ Double wantingUa = Arith.sub(maxUa, minUa);
|
|
|
+ if (wantingUa<voltageLevelWanting){
|
|
|
+ OverrunUa++;
|
|
|
+ }
|
|
|
+
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(RtAnalogDataList.get(i).getUb());
|
|
|
+ checkList.add(voltageLevel);
|
|
|
+ Double maxUb = checkList.stream().max(Double::compareTo).get();
|
|
|
+ Double minUb = checkList.stream().min(Double::compareTo).get();
|
|
|
+ Double wantingUb = Arith.sub(maxUb, minUb);
|
|
|
+ if (wantingUb<voltageLevelWanting){
|
|
|
+ OverrunUb ++;
|
|
|
+ }
|
|
|
+
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(RtAnalogDataList.get(i).getUc());
|
|
|
+ checkList.add(voltageLevel);
|
|
|
+ Double maxUc = checkList.stream().max(Double::compareTo).get();
|
|
|
+ Double minUc = checkList.stream().min(Double::compareTo).get();
|
|
|
+ Double wantingUc = Arith.sub(maxUc, minUc);
|
|
|
+ if (wantingUc<voltageLevelWanting){
|
|
|
+ OverrunUc ++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (RtAnalogDataList.get(i).getF()<50.2&&RtAnalogDataList.get(i).getF()>49.8){
|
|
|
+ OverrunF ++;
|
|
|
+ }
|
|
|
+
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(RtAnalogDataList.get(i).getIa());
|
|
|
+ checkList.add(RtAnalogDataList.get(i).getIb());
|
|
|
+ checkList.add(RtAnalogDataList.get(i).getIc());
|
|
|
+ //电流不平衡
|
|
|
+ Double ElBalun = checkBalun(checkList);
|
|
|
+ if (ElBalun<0.15){
|
|
|
+ OverrunElBalun ++;
|
|
|
+ }
|
|
|
+
|
|
|
+ checkList.clear();
|
|
|
+ checkList.add(RtAnalogDataList.get(i).getUa());
|
|
|
+ checkList.add(RtAnalogDataList.get(i).getUb());
|
|
|
+ checkList.add(RtAnalogDataList.get(i).getUc());
|
|
|
+ //电压不平衡
|
|
|
+ Double VtBalunQ = checkBalun(checkList);
|
|
|
+ if (VtBalunQ<0.15){
|
|
|
+ OverrunVtBalun ++;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ singleLoopReportOneVo.setProportionUa(singleLoopReportOneVo.getMeasuringPoints()-OverrunUa+"/"+singleLoopReportOneVo.getMeasuringPoints());
|
|
|
+ singleLoopReportOneVo.setProportionUb(singleLoopReportOneVo.getMeasuringPoints()-OverrunUb+"/"+singleLoopReportOneVo.getMeasuringPoints());
|
|
|
+ singleLoopReportOneVo.setProportionUc(singleLoopReportOneVo.getMeasuringPoints()-OverrunUc+"/"+singleLoopReportOneVo.getMeasuringPoints());
|
|
|
+ singleLoopReportOneVo.setProportionF(singleLoopReportOneVo.getMeasuringPoints()-OverrunF+"/"+singleLoopReportOneVo.getMeasuringPoints());
|
|
|
+ singleLoopReportOneVo.setProportionElBalun(singleLoopReportOneVo.getMeasuringPoints()-OverrunElBalun+"/"+singleLoopReportOneVo.getMeasuringPoints());
|
|
|
+ singleLoopReportOneVo.setProportionVtBalun(singleLoopReportOneVo.getMeasuringPoints()-OverrunVtBalun+"/"+singleLoopReportOneVo.getMeasuringPoints());
|
|
|
+ singleLoopReportOneVo.setQrUa(OverrunUa==0?00.00: Double.valueOf(df.format(Double.valueOf(OverrunUa)/Double.valueOf(singleLoopReportOneVo.getMeasuringPoints())*100)));
|
|
|
+ singleLoopReportOneVo.setQrUb(OverrunUb==0?00.00: Double.valueOf(df.format(Double.valueOf(OverrunUb)/Double.valueOf(singleLoopReportOneVo.getMeasuringPoints())*100)));
|
|
|
+ singleLoopReportOneVo.setQrUc(OverrunUc==0?00.00: Double.valueOf(df.format(Double.valueOf(OverrunUc)/Double.valueOf(singleLoopReportOneVo.getMeasuringPoints())*100)));
|
|
|
+ singleLoopReportOneVo.setQrF(OverrunF==0?00.00: Double.valueOf(df.format(Double.valueOf(OverrunF)/Double.valueOf(singleLoopReportOneVo.getMeasuringPoints())*100)));
|
|
|
+ singleLoopReportOneVo.setQrElBalun(OverrunElBalun==0?00.00: Double.valueOf(df.format(Double.valueOf(OverrunElBalun)/Double.valueOf(singleLoopReportOneVo.getMeasuringPoints()))));
|
|
|
+ singleLoopReportOneVo.setQrVtBalun(OverrunVtBalun==0?00.00: Double.valueOf(df.format(Double.valueOf(OverrunVtBalun)/Double.valueOf(singleLoopReportOneVo.getMeasuringPoints()))));
|
|
|
+ singleLoopReportOneVo.setVoltageLevelToplimit(voltageLevel+voltageLevelWanting);
|
|
|
+ singleLoopReportOneVo.setVoltageLevelLowerLimit(voltageLevel-voltageLevelWanting);
|
|
|
+ singleLoopReportOneVo.setMhz(50.00);
|
|
|
+ singleLoopReportOneVo.setFToplimit(50.2);
|
|
|
+ singleLoopReportOneVo.setFLowerLimit(49.8);
|
|
|
+ singleLoopReportOneVo.setAppraise(0.85);
|
|
|
+ singleLoopReportOneVo.setBalanceToplimit(15.00);
|
|
|
+ singleLoopReportOneVo.setBalanceLowerLimit(15.00);
|
|
|
+ return singleLoopReportOneVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Double VoltageQr(List<Double> checkList,Double voltageLevel){
|
|
|
+ Double max = checkList.stream().max(Double::compareTo).get();
|
|
|
+ Double min = checkList.stream().min(Double::compareTo).get();
|
|
|
+ Double wanting = Arith.sub(max, min);
|
|
|
+ Double QR = wanting / voltageLevel * 100;
|
|
|
+ return QR;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Double checkBalun(List<Double> list) {
|
|
|
+ long count = list.stream().filter(code -> 0.00 == code).count();
|
|
|
+ if (3 == count) {
|
|
|
+ return 0.00;
|
|
|
+ }
|
|
|
+ Double max = list.stream().max(Double::compareTo).get();
|
|
|
+ Double min = list.stream().min(Double::compareTo).get();
|
|
|
+ return Arith.div(Arith.sub(max, min), max);
|
|
|
+ }
|
|
|
+
|
|
|
}
|