Parcourir la source

样本库获取GPU服务器;
叶片分析;

chenminghua il y a 1 an
Parent
commit
0e8df2f255

+ 2 - 2
gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/HostparamController.java

@@ -21,8 +21,8 @@ public class HostparamController {
      */
     @GetMapping("/{host}/{port}")
     public JSONObject getHostParam(@PathVariable String  host,@PathVariable int port) {
-        JSONObject  json = hostparamService.exec(host,port);
-        return new JSONObject();
+        JSONObject json = hostparamService.exec(host,port);
+        return json;
     }
 
 }

+ 2 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/base/WindInfoController.java

@@ -103,6 +103,8 @@ public class WindInfoController {
             for (String id : pids){
                 Powerfittinganalysis item = powerService.getById(id);
                 Windturbine wt = InitialRunner.wtMap.get(item.getWindturbine());
+                wt.setProcessId(id);
+                wt.setFittingId(obj.getId());
                 result.add(wt);
             }
         }

+ 1 - 1
power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/BladeController.java

@@ -26,7 +26,7 @@ public class BladeController {
      */
     @GetMapping("angle")
     public JSONObject bladeAngle(String ids){
-        Object o = bladeService.bladeData(ids);
+        Object o = bladeService.bladeAngle(ids);
         return JsonResult.successData(ResultCode.SUCCESS, o);
     }
 }

+ 2 - 2
power-fitting/src/main/java/com/gyee/power/fitting/model/Windpowerstation.java

@@ -53,10 +53,10 @@ public class Windpowerstation extends Model<Windpowerstation> {
     private String aname;
 
     @TableField("LONGITUDE")
-    private String longitude;
+    private Double longitude;
 
     @TableField("LATITUDE")
-    private String latitude;
+    private Double latitude;
 
     @TableField("PHOTO")
     private String photo;

+ 6 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Windturbine.java

@@ -64,6 +64,12 @@ public class Windturbine extends Model<Windturbine> {
     @TableField("STANDARDID")
     private String standardid;
 
+    @TableField(exist = false)
+    private String prepareId;
+    @TableField(exist = false)
+    private String processId;
+    @TableField(exist = false)
+    private String fittingId;
 
     @Override
     protected Serializable pkVal() {

+ 5 - 1
power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PowerPointData.java

@@ -2,6 +2,7 @@ package com.gyee.power.fitting.model.custom;
 
 import com.gyee.power.fitting.model.anno.Desc;
 import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
 
 import java.text.DecimalFormat;
 
@@ -9,6 +10,7 @@ import java.text.DecimalFormat;
  * 数据准备的测点
  * remark  0:表示该字段不在前端显示  1:表示该字段在前端显示
  */
+@Slf4j
 @Data
 public class PowerPointData {
 
@@ -33,7 +35,9 @@ public class PowerPointData {
             this.yp3 = Double.valueOf(df.format(Double.valueOf(str[13])));
             if (isFilter)
                 this.filter = Integer.valueOf(str[str.length - 1]);
-        }catch (Exception e){}
+        }catch (Exception e){
+            log.error(e.getMessage());
+        }
     }
 
     //时间

+ 1 - 1
power-fitting/src/main/java/com/gyee/power/fitting/service/PowerwindinfoService.java

@@ -19,7 +19,7 @@ public interface PowerwindinfoService extends IService<Powerwindinfo> {
 
     /**
      * 通过风机ID和日期查询
-     * @param wtIds
+     * @param wtId
      * @param dates
      * @return
      */

+ 46 - 1
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/blade/BladeService.java

@@ -8,6 +8,8 @@ import lombok.val;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -22,7 +24,7 @@ public class BladeService {
      * @param ids
      * @return
      */
-    public Object bladeData(String ids){
+    public Object bladeAngle(String ids){
         Map<String, Object> result = new HashMap<>();
         List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
         if (list.size() == 0)
@@ -45,6 +47,9 @@ public class BladeService {
             mp.put("yp1", p1);
             mp.put("yp2", p2);
             mp.put("yp3", p3);
+            mp.put("c12", curveDeviation(p1, p2));
+            mp.put("c13", curveDeviation(p1, p3));
+            mp.put("c23", curveDeviation(p2, p3));
             mp.put("wt", obj.getWindturbine());
             if (time.size() == 0)
                 time.addAll(ls.stream().map(m -> m.getTime()).collect(Collectors.toList()));
@@ -56,6 +61,24 @@ public class BladeService {
         return result;
     }
 
+    public Object bladeAnalysis(String ids){
+        Map<String, Object> result = new HashMap<>();
+        List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
+        if (list.size() == 0)
+            return result;
+
+        for (int i = 0; i < list.size(); i++) {
+            Powerfittinganalysis obj = list.get(i);
+            List<PowerPointData> ls = csvParse(obj);
+            for (PowerPointData item : ls) {
+
+            }
+        }
+
+        return result;
+    }
+
+
     /**
      * csv 文件解析成对象
      * @param obj
@@ -73,4 +96,26 @@ public class BladeService {
         return list;
     }
 
+    /**
+     * 计算叶片的曲线偏差率
+     * @param ls1
+     * @param ls2
+     * @return
+     */
+    private double curveDeviation(List<Double> ls1, List<Double> ls2){
+        double result = 0;
+        if (ls1.size() == 0 || ls1.size() != ls2.size())
+            return result;
+
+        double count = 0;
+        for (int i = 0; i < ls1.size(); i++){
+            double diff = ls1.get(i) - ls2.get(i);
+            double v = ls2.get(i) != 0 ? diff / ls2.get(i) * 100 : diff;
+            count += v;
+        }
+        result = new BigDecimal(count / ls1.size()).setScale(2, RoundingMode.FLOOR).doubleValue();
+
+        return result;
+    }
+
 }

+ 14 - 17
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/temperature/PowerTemperatureService.java

@@ -35,23 +35,20 @@ public class PowerTemperatureService {
             return result;
 
         for (Powerfittinganalysis obj : list){
-            String[] pids = obj.getProcessid().split(",");
-            for (String id : pids){
-                Powerfittinganalysis pf = powerService.selectItemById(id);
-                List<Modelpowerdetails> ls = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid());
-                Double theoryPower = ls.get(ls.size() - 1).getTheorypower(); //理论功率
-                Map<String, Object> map = csvParse(pf);//数据解析
-                List<PowerPointData> data = (List<PowerPointData>) map.get("data");
-                Object res = PowerTemperatureAlg.temperatureRatedPower(data, theoryPower, (Double) map.get("minT"), (Double) map.get("maxT"));
-                List<int[]> rp = PowerTemperatureAlg.temperatureRatedPower(data);
-
-                Map<String, Object> mp = new HashMap<>();
-                mp.put("wt", pf.getWindturbine());
-                mp.put("power", InitialRunner.equipmentMap.get(InitialRunner.wtMap.get(pf.getWindturbine()).getModelid()));
-                mp.put("res1", res); //额定功率vs.温度分析
-                mp.put("res2", rp);  //额定功率vs.温度分析
-                result.add(mp);
-            }
+            Powerfittinganalysis pf = powerService.selectItemById(obj.getId());
+            List<Modelpowerdetails> ls = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid());
+            Double theoryPower = ls.get(ls.size() - 1).getTheorypower(); //理论功率
+            Map<String, Object> map = csvParse(pf);//数据解析
+            List<PowerPointData> data = (List<PowerPointData>) map.get("data");
+            Object res = PowerTemperatureAlg.temperatureRatedPower(data, theoryPower, (Double) map.get("minT"), (Double) map.get("maxT"));
+            List<int[]> rp = PowerTemperatureAlg.temperatureRatedPower(data);
+
+            Map<String, Object> mp = new HashMap<>();
+            mp.put("wt", pf.getWindturbine());
+            mp.put("power", InitialRunner.equipmentMap.get(InitialRunner.wtMap.get(pf.getWindturbine()).getModelid()));
+            mp.put("res1", res); //额定功率vs.温度分析
+            mp.put("res2", rp);  //额定功率vs.温度分析
+            result.add(mp);
         }
 
         return result;

+ 8 - 8
power-fitting/src/main/resources/application.yaml

@@ -38,16 +38,16 @@ spring:
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
     # 宁夏三区oracle
-    driver-class-name: oracle.jdbc.OracleDriver
-    url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
-    username: nxfdprod
-    password: gdnxfd123
+#    driver-class-name: oracle.jdbc.OracleDriver
+#    url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
+#    username: nxfdprod
+#    password: gdnxfd123
 
     # 华为云oracle(功率预测的环境)
-#    driver-class-name: oracle.jdbc.OracleDriver
-#    url: jdbc:oracle:thin:@120.46.129.85:1521:ORCL
-#    username: gyee
-#    password: FRWIND
+    driver-class-name: oracle.jdbc.OracleDriver
+    url: jdbc:oracle:thin:@120.46.129.85:1521:ORCL
+    username: gyee
+    password: FRWIND
 
     # 本地sql-lite
 #    driver-class-name: org.sqlite.JDBC