Browse Source

AGC接口添加新选项卡

王波 1 month ago
parent
commit
1a8a1af0f5

+ 12 - 1
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/agc/AgcDeviateController.java

@@ -6,13 +6,17 @@ import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.TypeReference;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.common.model.PointData;
 import com.gyee.runeconomy.config.GyeeConfig;
 import com.gyee.runeconomy.init.CacheContext;
+import com.gyee.runeconomy.mapper.PowerLossesMapper;
+import com.gyee.runeconomy.model.PowerLosses;
 import com.gyee.runeconomy.model.StatusTime;
 import com.gyee.runeconomy.model.auto.PointInfo;
 import com.gyee.runeconomy.model.auto.ProBasicEquipment;
 import com.gyee.runeconomy.model.auto.ProBasicEquipmentPoint;
+import com.gyee.runeconomy.service.PowerLossesService;
 import com.gyee.runeconomy.service.agc.AgcDeviateService;
 import com.gyee.runeconomy.service.auto.IPointInfoService;
 import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
@@ -50,6 +54,8 @@ public class AgcDeviateController {
 
     @Resource
     private IPointInfoService pointInfoService;
+    @Resource
+    private PowerLossesMapper powerLossesMapper;
 
     /**
      * 获取偏差信息
@@ -73,7 +79,12 @@ public class AgcDeviateController {
         }
         return ls.stream().collect(Collectors.toMap(AgcDeviateTag::getName, f -> f));
     }
-
+    @GetMapping("/xdloss")
+    public List<PowerLosses> getxdData() {
+        QueryWrapper<PowerLosses> queryWrapper = new QueryWrapper<>();
+        List<PowerLosses> powerLosses = powerLossesMapper.selectList(queryWrapper);
+        return powerLosses;
+    }
     /**
      * 获取配置
      *

+ 16 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/mapper/PowerLossesMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.runeconomy.mapper;
+
+import com.gyee.runeconomy.model.PowerLosses;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author wang
+ * @since 2025-02-24
+ */
+public interface PowerLossesMapper extends BaseMapper<PowerLosses> {
+
+}

+ 42 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/PowerLosses.java

@@ -0,0 +1,42 @@
+package com.gyee.runeconomy.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author wang
+ * @since 2025-02-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("power_losses")
+public class PowerLosses extends Model<PowerLosses> {
+
+    private static final long serialVersionUID=1L;
+
+    private Integer id;
+
+    private LocalDateTime startTime;
+
+    private LocalDateTime endTime;
+
+    private String xdss;
+
+    private LocalDate recordDate;
+
+
+    @Override
+    public Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 16 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/PowerLossesService.java

@@ -0,0 +1,16 @@
+package com.gyee.runeconomy.service;
+
+import com.gyee.runeconomy.model.PowerLosses;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author wang
+ * @since 2025-02-24
+ */
+public interface PowerLossesService extends IService<PowerLosses> {
+
+}

+ 50 - 4
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/WindDirection/WindALG.java

@@ -301,7 +301,7 @@ public class WindALG {
             PowerPointData item = list.get(i);
             double dfwc = 0;
             if (equipments.size()>0) {
-                dfwc = Math.abs(item.getDfwc()) * 57.2958;//对风误差-弧度转角度
+                dfwc = Math.abs(item.getDfwc()) * 57.2958;//对风误差进行弧度转角度
             } else {
                 dfwc = Math.abs(item.getDfwc());
             }
@@ -382,12 +382,23 @@ public class WindALG {
      * @param list
      * @return
      */
-    public static int[] windDeviationRatio(List<PowerPointData> list){
+    public static int[] windDeviationRatio(List<PowerPointData> list,List<ProBasicEquipment> equipments){
         int[] pc = new int[101];  //正负偏差 [-50,-49,....,0,1,2,.....50]
         //次数统计
+        List<Double> dfwcls = new ArrayList<>();
+        List<Double> fxls = new ArrayList<>();
         for (int i = 0; i < list.size(); i++){
             PowerPointData item = list.get(i);
-            int ele = (int) (Math.abs(item.getFx()) + Math.abs(item.getDfwc()));
+            double dfwc = 0;
+            if (equipments.size()>0) {
+                dfwc = Math.abs(item.getDfwc()) *  57.2958;
+                dfwcls.add(dfwc);
+            } else {
+                dfwc = Math.abs(item.getDfwc());
+                dfwcls.add(dfwc);
+            }
+            fxls.add(item.getFx());
+            int ele = (int) (Math.abs(item.getFx()) + dfwc);
             int index = ele - 180;
             if (index >= -50 && index <= 50)
                 pc[50-(index > 0 ? -index : Math.abs(index))]++;
@@ -396,7 +407,42 @@ public class WindALG {
         return pc;
     }
 
-
+//    public static int[] windDeviationRatio(List<PowerPointData> list, List<ProBasicEquipment> equipments) {
+//        int[] pc = new int[101];
+//
+//        for (int i = 0; i < list.size(); i++) {
+//            PowerPointData item = list.get(i);
+//            double fx = item.getFx();
+//            double dfwc = 0;
+//
+//
+//            fx = (fx + 360) % 360;
+//
+//
+//            if (equipments.size() > 0) {
+//                dfwc = Math.abs(item.getDfwc()) * 57.2958;
+//            } else {
+//                dfwc = Math.abs(item.getDfwc());
+//            }
+//
+//
+//            double ele = (fx + dfwc) % 360;
+//
+//
+//            int index = (int) (ele - 180);
+//
+//
+//            if (ele >= 130 && ele <= 230) {
+//
+//                int pcIndex = 50 + index;
+//                if (pcIndex >= 0 && pcIndex <= 100) {
+//                    pc[pcIndex]++;
+//                }
+//            }
+//        }
+//
+//        return pc;
+//    }
     /**
      * 风向划分
      * 0:0-22.5

+ 1 - 1
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/WindDirection/WindDirectionService.java

@@ -491,7 +491,7 @@ public class WindDirectionService {
         List<ProBasicEquipment> listObj = CacheContext.wtls.stream().filter(wt -> wtid.equals(wt.getId())).collect(Collectors.toList());
 
             listObj.forEach(obj -> {
-                int[] count = WindALG.windDeviationRatio(filterls);//风向、对风误差
+                int[] count = WindALG.windDeviationRatio(filterls,equipments);//风向、对风误差
                 List<Point> scatter = WindALG.windDeviationScatter(filterls,equipments);//风速、风向、对风误差
                 Map<String, Object> map = new HashMap<>();
                 map.put("wtId", obj.getAname());

+ 1 - 1
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/agc/AgcDeviateService.java

@@ -214,7 +214,7 @@ public class AgcDeviateService {
             return null;
         }
         AiPoints[] aiPoints = CacheContext.agcDeviateConfigMap.get(id).getAiPoints();
-        return Arrays.stream(aiPoints).filter(ap -> ap.getName().contains("功") && !ap.getName().contains("预测")).collect(Collectors.toList());
+        return Arrays.stream(aiPoints).filter(ap -> ap.getName().contains("功") || ap.getName().contains("风") && !ap.getName().contains("预测")).collect(Collectors.toList());
     }
 
     private double getCapacity(String id) {

+ 20 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/impl/PowerLossesServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.runeconomy.service.impl;
+
+import com.gyee.runeconomy.model.PowerLosses;
+import com.gyee.runeconomy.mapper.PowerLossesMapper;
+import com.gyee.runeconomy.service.PowerLossesService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author wang
+ * @since 2025-02-24
+ */
+@Service
+public class PowerLossesServiceImpl extends ServiceImpl<PowerLossesMapper, PowerLosses> implements PowerLossesService {
+
+}