Kaynağa Gözat

信控集控服务修改

shilin 2 yıl önce
ebeveyn
işleme
a4ff24c941

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ProEconEquipmentInfoDayTopController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 风机日信息表排行 前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-09
+ */
+@RestController
+@RequestMapping("//pro-econ-equipment-info-day-top")
+public class ProEconEquipmentInfoDayTopController {
+
+}

+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconEquipmentInfoDayTopMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDayTop;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 风机日信息表排行 Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-09
+ */
+public interface ProEconEquipmentInfoDayTopMapper extends BaseMapper<ProEconEquipmentInfoDayTop> {
+
+}

+ 409 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconEquipmentInfoDayTop.java

@@ -0,0 +1,409 @@
+package com.gyee.generation.model.auto;
+
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 风机日信息表排行
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-09
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProEconEquipmentInfoDayTop extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @TableId(value = "ID",type = IdType.ASSIGN_ID)
+    private Integer id;
+
+    /**
+     * 风场编号
+     */
+    private String windpowerstationId;
+
+    /**
+     * 项目编号
+     */
+    private String projectId;
+
+    /**
+     * 线路编号
+     */
+    private String lineId;
+
+    /**
+     * 风机编号
+     */
+    private String windturbineId;
+
+    /**
+     * 日期
+     */
+    private Date recordDate;
+
+    /**
+     * 发电量
+     */
+    private Double dayfdl;
+
+    /**
+     * 发电量月
+     */
+    private Double monthfdl;
+
+    /**
+     * 发电量年
+     */
+    private Double yearfdl;
+
+    /**
+     * 理论发电量
+     */
+    private Double dayllfdl;
+
+    /**
+     * 理论发电量月
+     */
+    private Double monthllfdl;
+
+    /**
+     * 理论发电量年
+     */
+    private Double yearllfdl;
+
+    /**
+     * 平均风速
+     */
+    private Double dayfs;
+
+    /**
+     * 月平均风速
+     */
+    private Double monthfs;
+
+    /**
+     * 年平均风速
+     */
+    private Double yearfs;
+
+    /**
+     * 平均功率
+     */
+    private Double daygl;
+
+    /**
+     * 月平均功率
+     */
+    private Double monthgl;
+
+    /**
+     * 年平均功率
+     */
+    private Double yeargl;
+
+    /**
+     * 故障损失电量
+     */
+    private Double daygzssdl;
+
+    /**
+     * 月故障损失电量
+     */
+    private Double monthgzssdl;
+
+    /**
+     * 年故障损失电量
+     */
+    private Double yeargzssdl;
+
+    /**
+     * 日限电损失电量
+     */
+    private Double dayxdssdl;
+
+    /**
+     * 月限电损失电量
+     */
+    private Double monthxdssdl;
+
+    /**
+     * 年限电损失电量
+     */
+    private Double yearxdssdl;
+
+    /**
+     * 日维护损失电量
+     */
+    private Double daywhssdl;
+
+    /**
+     * 月维护损失电量
+     */
+    private Double monthwhssdl;
+
+    /**
+     * 年维护损失电量
+     */
+    private Double yearwhssdl;
+
+    /**
+     * 日性能损失电量
+     */
+    private Double dayxnssdl;
+
+    /**
+     * 月性能损失电量
+     */
+    private Double monthxnssdl;
+
+    /**
+     * 年性能损失电量
+     */
+    private Double yearxnssdl;
+
+    /**
+     * 日故障时间
+     */
+    private Double daygzsj;
+
+    /**
+     * 月故障时间
+     */
+    private Double monthgzsj;
+
+    /**
+     * 年故障时间
+     */
+    private Double yeargzsj;
+
+    /**
+     * 日维护时间
+     */
+    private Double daywhsj;
+
+    /**
+     * 月维护时间
+     */
+    private Double monthwhsj;
+
+    /**
+     * 年维护时间
+     */
+    private Double yearwhsj;
+
+    /**
+     * 日运行时间
+     */
+    private Double dayyxsj;
+
+    /**
+     * 月运行时间
+     */
+    private Double monthyxsj;
+
+    /**
+     * 年运行时间
+     */
+    private Double yearyxsj;
+
+    /**
+     * 日停机时间
+     */
+    private Double daytjsj;
+
+    /**
+     * 月停机时间
+     */
+    private Double monthtjsj;
+
+    /**
+     * 年停机时间
+     */
+    private Double yeartjsj;
+
+    /**
+     * 日利用小时数
+     */
+    private Double daylyxs;
+
+    /**
+     * 月利用小时数
+     */
+    private Double monthlyxs;
+
+    /**
+     * 年利用小时数
+     */
+    private Double yearlyxs;
+
+    /**
+     * 日拟合优度
+     */
+    private Double daynhyd;
+
+    /**
+     * 月拟合优度
+     */
+    private Double monthnhyd;
+
+    /**
+     * 年拟合优度
+     */
+    private Double yearnhyd;
+
+    /**
+     * 日设备可利用率
+     */
+    private Double daysbklyl;
+
+    /**
+     * 月设备可利用率
+     */
+    private Double monthsbklyl;
+
+    /**
+     * 年设备可利用率
+     */
+    private Double yearsbklyl;
+
+    /**
+     * 日等效可用系数
+     */
+    private Double daydxkyxs;
+
+    /**
+     * 月等效可用系数
+     */
+    private Double monthdxkyxs;
+
+    /**
+     * 年等效可用系数
+     */
+    private Double yeardxkyxs;
+
+    /**
+     * 有效风时数
+     */
+    private Double dayyxfss;
+
+    /**
+     * 月有效风时数
+     */
+    private Double monthyxfss;
+
+    /**
+     * 年有效风时数
+     */
+    private Double yearyxfss;
+
+    /**
+     * 日小风切入
+     */
+    private Double dayxfqr;
+
+    /**
+     * 月小风切入
+     */
+    private Double monthxfqr;
+
+    /**
+     * 年小风切入
+     */
+    private Double yearxfqr;
+
+    /**
+     * 日静风频率
+     */
+    private Double dayjfpl;
+
+    /**
+     * 月静风频率
+     */
+    private Double monthjfpl;
+
+    /**
+     * 年静风频率
+     */
+    private Double yearjfpl;
+
+    /**
+     * 日功率一致性系数
+     */
+    private Double dayglyzxxs;
+
+    /**
+     * 月功率一致性系数
+     */
+    private Double monthglyzxxs;
+
+    /**
+     * 年功率一致性系数
+     */
+    private Double yearglyzxxs;
+
+    /**
+     * 类型
+     */
+    private Integer types;
+
+
+    /**
+     *年
+     */
+    private Integer year;
+    /**
+     *月
+     */
+    private Integer month;
+
+
+    /**
+     * 综合排名
+     */
+    private Integer dayRank;
+
+    /**
+     * 等级
+     */
+    private String dayLevel;
+
+    /**
+     * 综合排名
+     */
+    private Integer monthRank;
+
+    /**
+     * 等级
+     */
+    private String monthLevel;
+
+    /**
+     * 综合排名
+     */
+    private Integer yearRank;
+
+    /**
+     * 等级
+     */
+    private String yearLevel;
+
+    /**
+     * 分数
+     */
+    private Double dayScore;
+    private Double monthScore;
+    private Double yearScore;
+}

+ 15 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/CsvVo.java

@@ -0,0 +1,15 @@
+package com.gyee.generation.model.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class CsvVo {
+
+    public Date  date;
+    public Double power;
+    public Double speed;
+    public Integer status;
+    public Integer lackpower;
+}

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1181 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfoDayTopService.java


+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconEquipmentInfoDayTopService.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDayTop;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 风机日信息表排行 服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-09
+ */
+public interface IProEconEquipmentInfoDayTopService extends IService<ProEconEquipmentInfoDayTop> {
+
+}

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconEquipmentInfoDayTopServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDayTop;
+import com.gyee.generation.mapper.auto.ProEconEquipmentInfoDayTopMapper;
+import com.gyee.generation.service.auto.IProEconEquipmentInfoDayTopService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 风机日信息表排行 服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-09
+ */
+@Service
+public class ProEconEquipmentInfoDayTopServiceImpl extends ServiceImpl<ProEconEquipmentInfoDayTopMapper, ProEconEquipmentInfoDayTop> implements IProEconEquipmentInfoDayTopService {
+
+}

+ 228 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/math/LineUtil.java

@@ -0,0 +1,228 @@
+package com.gyee.generation.util.realtimesource.math;
+
+import com.gyee.generation.model.vo.PointVo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LineUtil {
+
+    /// <summary>
+    /// 用最小二乘法拟合二元多次曲线
+    /// </summary>
+    /// <param name="arrX">已知点的x坐标集合</param>
+    /// <param name="arrY">已知点的y坐标集合</param>
+    /// <param name="length">已知点的个数</param>
+    /// <param name="dimension">方程的最高次数</param>
+    /// <param name="scale">曲线的刻度</param>
+    /// <returns></returns>
+    public static List<PointVo> buildLine(double[] arrX, double[] arrY, int length, int dimension, double scale)
+    {
+
+        List<PointVo> points =new ArrayList<PointVo>();
+
+        if (arrX.length != arrY.length || arrX.length<3)
+        {
+            return points;
+        }
+
+        double minValue=arrY[0];
+        double maxValue=arrY[arrY.length-1];
+
+
+        double min = 0;
+        double max= 0;
+
+        double[] coefficient = multiLine(arrX, arrY, length, dimension);
+
+        for (double i = arrX[0]; i <= arrX[arrX.length - 1]; i += scale)
+        {
+            PointVo point = new PointVo();
+            point.setX(i);
+
+
+            for (int j = 0; j < coefficient.length; j++)
+            {
+                if(j==0)
+                {
+                    point.setY(coefficient[j] * Math.pow(point.getX(), (double)j));
+                }else
+                {
+                    double temp=coefficient[j] * Math.pow(point.getX(), (double)j);
+                    point.setY(point.getY()+temp);
+                }
+
+            }
+            if (point.getY() < minValue)
+            {
+                point.setY(minValue);
+   
+            }
+            if (point.getY() > maxValue)
+            {
+                point.setY(maxValue);
+            }
+
+            if (point.getY() < min)
+            {
+                min = point.getY();
+            }
+            if (point.getY() > max)
+            {
+                max = point.getY();
+            }
+
+            points.add(point);
+        }
+        builder(points, min, max);
+        return points;
+    }
+
+    private static void builder(List<PointVo> points, double min, double max)
+    {
+        boolean b = false;
+        for (int i = 0; i < points.size(); i++)
+        {
+            if (b)
+            {
+                points.get(i).setY(max);
+            }
+            else
+            {
+                if (max == points.get(i).getY())
+                {
+                    b = true;
+                }
+            }
+
+        }
+
+        for (int i = points.size()-1; i > -1; i--)
+        {
+            if (!b)
+            {
+                points.get(i).setY(min);
+            }
+            else
+            {
+                if (min == points.get(i).getY())
+                {
+                    b = false;
+                }
+            }
+
+        }
+    }
+
+
+
+    ///<summary>
+    ///用最小二乘法拟合二元多次曲线
+    ///</summary>
+    ///<param name="arrX">已知点的x坐标集合</param>
+    ///<param name="arrY">已知点的y坐标集合</param>
+    ///<param name="length">已知点的个数</param>
+    ///<param name="dimension">方程的最高次数</param>
+    public static double[] multiLine(double[] arrX, double[] arrY, int length, int dimension)//二元多次线性方程拟合曲线
+    {
+        int n = dimension + 1;                  //dimension次方程需要求 dimension+1个 系数
+        double[][] guass = new double[n][n+1];      //高斯矩阵 例如:y=a0+a1*x+a2*x*x
+        for (int i = 0; i < n; i++)
+        {
+            int j;
+            for (j = 0; j < n; j++)
+            {
+                guass[i][j] = sumArr(arrX, j + i, length);
+            }
+            guass[i][j]= sumArr(arrX, i, arrY, 1, length);
+        }
+        return computGauss(guass, n);
+    }
+    public static double sumArr(double[] arr, int n, int length) //求数组的元素的n次方的和
+    {
+        double s = 0;
+        for (int i = 0; i < length; i++)
+        {
+            if (arr[i] != 0 || n != 0)
+                s = s + Math.pow(arr[i], n);
+            else
+                s = s + 1;
+        }
+        return s;
+    }
+    public static double sumArr(double[] arr1, int n1, double[] arr2, int n2, int length)
+    {
+        double s = 0;
+        for (int i = 0; i < length; i++)
+        {
+            if ((arr1[i] != 0 || n1 != 0) && (arr2[i] != 0 || n2 != 0))
+                s = s + Math.pow(arr1[i], n1) * Math.pow(arr2[i], n2);
+            else
+                s = s + 1;
+        }
+        return s;
+
+    }
+    public static double[] computGauss(double[][] guass, int n)
+    {
+        int i, j;
+        int k, m;
+        double temp;
+        double max;
+        double s;
+        double[] x = new double[n];
+        for (i = 0; i < n; i++) x[i] = 0.0;//初始化
+
+        for (j = 0; j < n; j++)
+        {
+            max = 0;
+            k = j;
+            for (i = j; i < n; i++)
+            {
+                if (Math.abs(guass[i][j]) > max)
+                {
+                    max = guass[i][j];
+                    k = i;
+                }
+            }
+
+
+            if (k != j)
+            {
+                for (m = j; m < n + 1; m++)
+                {
+                    temp = guass[j][m];
+                    guass[j][m]= guass[k][m];
+                    guass[k][m] = temp;
+                }
+            }
+            if (0 == max)
+            {
+                // "此线性方程为奇异线性方程" 
+                return x;
+            }
+
+            for (i = j + 1; i < n; i++)
+            {
+                s = guass[i][j];
+                for (m = j; m < n + 1; m++)
+                {
+                    guass[i][m] = guass[i][m] - guass[j][m] * s / (guass[j][j]);
+                }
+            }
+
+        }//结束for (j=0;j<n;j++)
+
+        for (i = n - 1; i >= 0; i--)
+        {
+            s = 0;
+            for (j = i + 1; j < n; j++)
+            {
+                s = s + guass[i][j] * x[j];
+            }
+            x[i] = (guass[i][n]- s) / guass[i][i];
+        }
+        return x;
+    }//返回值是函数的系数
+}
+

+ 85 - 0
realtime/generationXK-service/src/test/java/com/gyee/generation/CsvTest.java

@@ -0,0 +1,85 @@
+package com.gyee.generation;
+
+
+import com.gyee.common.util.SortUtils;
+import com.gyee.generation.model.vo.CsvVo;
+
+
+import com.gyee.generation.model.vo.PointVo;
+import com.gyee.generation.util.StringUtils;
+import com.gyee.generation.util.realtimesource.math.LineUtil;
+import com.opencsv.CSVReader;
+
+
+import java.io.FileReader;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import java.util.stream.Collectors;
+
+
+/**
+ * OpenCSV CSVReader Example, Read line by line
+ *
+ * @author pankaj
+ *
+ */
+public class CsvTest {
+
+    private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+
+    public static void main(String[] args) throws Exception {
+        CSVReader csvReader = new CSVReader(new FileReader("d:\\NG01_02.csv"));
+        String[] titles = csvReader.readNext(); //读取到第一行 是小标题
+//        时间	风机功率	风机风速	风机明细状态	欠发状态
+
+        List<CsvVo> vols=new ArrayList<>();
+        CsvVo vo = null;
+        while (true){
+            vo = new CsvVo();
+            String[] content = csvReader.readNext();
+            if(content==null){
+                break;
+            }
+            vo.setDate(StringUtils.toDate(content[0],"yyyy/MM/dd HH:mm"));
+            vo.setPower(Double.valueOf(content[1]));
+            vo.setSpeed(Double.valueOf(content[2]));
+            vo.setStatus(Integer.valueOf(content[3]));
+            vo.setLackpower(Integer.valueOf(content[4]));
+
+
+            vols.add(vo);
+        }
+
+        if(!vols.isEmpty())
+        {
+//            List<CsvVo> vos=vols.stream().filter(i->i.power>0
+//                    && i.getSpeed()>0
+//                    && i.getLackpower()<=2
+//                    && i.getStatus()==2
+//            ) .sorted(Comparator.comparing(CsvVo::getSpeed)).collect(Collectors.toList());
+            List<CsvVo> vos=vols.stream().filter(i->i.power>0
+                    && i.getSpeed()>2.5
+                    && i.getLackpower()<=2
+                    && i.getStatus()==2
+            ).collect(Collectors.toList());
+            SortUtils.sort(vos,"speed",SortUtils.ASC);
+
+
+
+
+            List<PointVo> temp = LineUtil.buildLine(vos.stream().mapToDouble(i -> i.getSpeed()).toArray(), vos.stream().mapToDouble(i -> i.getPower()).toArray(), vos.size(), 20, 0.01);
+            if(!temp.isEmpty())
+            {
+                for(PointVo v:temp)
+                {
+                    System.out.println("x="+v.getX()+",y="+v.getY());
+                }
+            }
+        }
+    }
+
+
+
+}