|
@@ -38,6 +38,8 @@ public class SaveLineFDL_15Min {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
public void saveLineFDL_15Min() {
|
|
|
|
|
|
//1,查询所有风电场
|
|
@@ -58,6 +60,105 @@ public class SaveLineFDL_15Min {
|
|
|
//获取测点code
|
|
|
String pointcode = meterPoint.getNemCode();
|
|
|
|
|
|
+ DateTime nowDateTime = DateUtil.parse(DateUtil.now());
|
|
|
+
|
|
|
+ //设置取值开始时间
|
|
|
+ DateTime startDateTime = DateUtil.beginOfHour(nowDateTime);
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i <= 3; i++) {
|
|
|
+
|
|
|
+ //开始时间00:00:01
|
|
|
+ DateTime dateTime1 = DateUtil.offsetMinute(startDateTime, (i-1)*15);
|
|
|
+ DateTime dateTime2 = DateUtil.offsetMinute(startDateTime, i*15);
|
|
|
+ BigDecimal bigDecimal1 = new BigDecimal(0);
|
|
|
+ BigDecimal bigDecimal2 = new BigDecimal(0);
|
|
|
+ BigDecimal rfdl = new BigDecimal(0);
|
|
|
+
|
|
|
+
|
|
|
+ List<PointData> historyRaw = adapter.getHistoryRaw(pointcode, dateTime1.getTime(), dateTime2.getTime());
|
|
|
+
|
|
|
+ if (historyRaw.size() > 0) {
|
|
|
+ bigDecimal1 = new BigDecimal(Double.toString(historyRaw.get(0).getValue()));
|
|
|
+ bigDecimal1 = bigDecimal1.divide(meterPoint.getXs(), 4, RoundingMode.HALF_EVEN);
|
|
|
+ bigDecimal2 = new BigDecimal(Double.toString(historyRaw.get(historyRaw.size() - 1).getValue()));
|
|
|
+ bigDecimal2 = bigDecimal2.divide(meterPoint.getXs(), 4, RoundingMode.HALF_EVEN);
|
|
|
+ rfdl = bigDecimal2.subtract(bigDecimal1).multiply(meterPoint.getMagnification());
|
|
|
+
|
|
|
+ if (rfdl.doubleValue() > 50000 || rfdl.doubleValue() < 0) {
|
|
|
+
|
|
|
+ ArrayList<Double> arrayList = new ArrayList<>();
|
|
|
+ for (PointData pointData : historyRaw) {
|
|
|
+ arrayList.add(pointData.getValue());
|
|
|
+ }
|
|
|
+ int index = -1;
|
|
|
+ // 定义增长阈值
|
|
|
+ double threshold = 50000.0;
|
|
|
+
|
|
|
+ for (int j = 1; j < arrayList.size(); j++) {
|
|
|
+ double current = arrayList.get(j);
|
|
|
+ double previous = arrayList.get(j - 1);
|
|
|
+ double difference = current - previous;
|
|
|
+ if (difference > threshold) {
|
|
|
+ index = j;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (index != -1) {
|
|
|
+ double valueGrow2 = arrayList.get(index);
|
|
|
+ BigDecimal bigDecimalGrow2 = new BigDecimal(Double.toString(valueGrow2));
|
|
|
+ double valueGrow1 = arrayList.get(index - 1);
|
|
|
+ BigDecimal bigDecimalGrow1 = new BigDecimal(Double.toString(valueGrow1));
|
|
|
+ rfdl = (bigDecimal2.subtract(bigDecimalGrow2).add(bigDecimalGrow1).subtract(bigDecimal1)).multiply(meterPoint.getMagnification());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ProMeterLineFDL15Min meterInfoBottomcode = new ProMeterLineFDL15Min();
|
|
|
+ meterInfoBottomcode.setName(meterPoint.getDescription());
|
|
|
+ meterInfoBottomcode.setStartTime(dateTime1.toLocalDateTime());
|
|
|
+ meterInfoBottomcode.setStartValue(bigDecimal1);
|
|
|
+ meterInfoBottomcode.setEndTime(dateTime2.toLocalDateTime());
|
|
|
+ meterInfoBottomcode.setEndValue(bigDecimal2);
|
|
|
+ meterInfoBottomcode.setDayValue(rfdl);
|
|
|
+ meterInfoBottomcode.setCode(pointcode);
|
|
|
+ meterInfoBottomcode.setWindpowerstationId(meterPoint.getWindpowerstationId());
|
|
|
+
|
|
|
+ QueryWrapper<ProMeterLineFDL15Min> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper
|
|
|
+ .eq("start_time", dateTime1.toLocalDateTime())
|
|
|
+ .eq("code", meterPoint.getNemCode());
|
|
|
+ List<ProMeterLineFDL15Min> list = proMeterLineFDL15MinService.list(queryWrapper);
|
|
|
+ if (list.size() > 0) {
|
|
|
+ meterInfoBottomcode.update(queryWrapper);
|
|
|
+ } else {
|
|
|
+ meterInfoBottomcode.insert();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void saveLineFDL_15Min0() {
|
|
|
+
|
|
|
+ //1,查询所有风电场
|
|
|
+ List<PowerStation> powerStationList = powerStationService.list(new QueryWrapper<PowerStation>()
|
|
|
+ .like("nem_code", "_FDC_"));
|
|
|
+
|
|
|
+ for (PowerStation powerStation : powerStationList) {
|
|
|
+ //2,根据场站ID得到场站下所有测点
|
|
|
+ List<MeterPoint> meterPointList = meterPointService.list(new QueryWrapper<MeterPoint>()
|
|
|
+ .eq("windpowerstation_id", powerStation.getId())
|
|
|
+ .eq("property", "CD")
|
|
|
+ .eq("meter_type", "线路")
|
|
|
+ .like("meter_class", "集电线路")
|
|
|
+ );
|
|
|
+
|
|
|
+ //3,遍历测点,拿到每个测点的nem_code
|
|
|
+ for (MeterPoint meterPoint : meterPointList) {
|
|
|
+ //获取测点code
|
|
|
+ String pointcode = meterPoint.getNemCode();
|
|
|
+
|
|
|
//2,获取当前日期,当日开始时间
|
|
|
DateTime nowDateTime = DateUtil.parse(DateUtil.now());
|
|
|
|
|
@@ -68,6 +169,9 @@ public class SaveLineFDL_15Min {
|
|
|
BigDecimal bigDecimal2 = new BigDecimal(0);
|
|
|
BigDecimal rfdl = new BigDecimal(0);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
List<PointData> historyRaw = adapter.getHistoryRaw(pointcode, dateTime1.getTime(), dateTime2.getTime());
|
|
|
|
|
|
if (historyRaw.size() > 0) {
|
|
@@ -132,6 +236,9 @@ public class SaveLineFDL_15Min {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|