|
@@ -4,6 +4,7 @@ import com.gyee.power.fitting.common.alg.DBSCANPointALG;
|
|
|
import com.gyee.power.fitting.common.config.GyeeConfig;
|
|
|
import com.gyee.power.fitting.common.constants.Constants;
|
|
|
import com.gyee.power.fitting.common.spring.InitialRunner;
|
|
|
+import com.gyee.power.fitting.common.util.DateUtil;
|
|
|
import com.gyee.power.fitting.common.util.FileUtil;
|
|
|
import com.gyee.power.fitting.common.alg.PowerFittingALG;
|
|
|
import com.gyee.power.fitting.common.util.PowerFittingUtil;
|
|
@@ -278,6 +279,7 @@ public class DataFittingService {
|
|
|
|
|
|
//功率曲线拟合
|
|
|
List<Point> temp = PowerFittingALG.buildLine(arrX, arrY, arraySpeed.size(), dimension, 0.01);
|
|
|
+ temp.forEach(f -> { if (f.getX() < 2.5 && f.getY() > 0) f.setY(0); });
|
|
|
|
|
|
//推力系数 CP值
|
|
|
LineCurveFitting lf = new LineCurveFitting();
|
|
@@ -285,14 +287,7 @@ public class DataFittingService {
|
|
|
lf = PowerFittingALG.buildCp(InitialRunner.equipmentMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid()).getSweptarea(), lf);
|
|
|
|
|
|
//曲线偏差率
|
|
|
- List<Point> pointsAll = new ArrayList<>();
|
|
|
- List<Modelpowerdetails> mp = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid());
|
|
|
- for (int i = 0; i < mp.size(); i++){
|
|
|
- Modelpowerdetails power = mp.get(i);
|
|
|
- pointsAll.add(new Point(power.getSpeed(), power.getEnsurepower()));
|
|
|
- }
|
|
|
- double maxp = mp.stream().max(Comparator.comparing(d -> d.getEnsurepower())).get().getEnsurepower();
|
|
|
- double pcl = PowerFittingALG.curveDeviationRatio(temp, pointsAll, maxp);
|
|
|
+ dataCurveRatio(lf, obj);
|
|
|
|
|
|
String content = assemble(lf);
|
|
|
String prepareId = "";
|
|
@@ -314,7 +309,6 @@ public class DataFittingService {
|
|
|
obj.setPath(fileName);
|
|
|
obj.setPrepareid(prepareId);
|
|
|
obj.setCpavg(lf.getCpAvg());
|
|
|
- obj.setPcratio(pcl);
|
|
|
obj.setType(Constants.DATA_FITTING);
|
|
|
powerService.insertItem(obj);
|
|
|
}
|
|
@@ -350,35 +344,36 @@ public class DataFittingService {
|
|
|
|
|
|
/**
|
|
|
* 曲线偏差率 分段的+全部的
|
|
|
- * @param id
|
|
|
* 3-5 5-10 10-12 12-25
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Double> dataCurveRatio(String id) {
|
|
|
- Map<String, Double> map = new HashMap<>();
|
|
|
+ private void dataCurveRatio(LineCurveFitting lf, Powerfittinganalysis obj) {
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
- Powerfittinganalysis obj = powerService.selectItemById(id);
|
|
|
try{
|
|
|
//风速、实际功率
|
|
|
+ List<Point> point = new ArrayList<>(); //3-25m
|
|
|
List<Point> point5 = new ArrayList<>(); //分段
|
|
|
List<Point> point10 = new ArrayList<>(); //分段
|
|
|
List<Point> point12= new ArrayList<>(); //分段
|
|
|
List<Point> point25 = new ArrayList<>(); //分段
|
|
|
- List<String> ls = FileUtil.readFile(obj.getPath(), true);
|
|
|
- for (int i = 1; i < ls.size(); i++){
|
|
|
- String[] split = ls.get(i).split(",");
|
|
|
- double speed = Double.valueOf(split[0]);
|
|
|
+ List<Point> line = lf.getYLines();
|
|
|
+ for (int i = 1; i < line.size(); i++){
|
|
|
+ double speed = Double.valueOf(df.format(line.get(i).getX()));
|
|
|
if (speed >= 3 && speed < 5)
|
|
|
- point5.add(new Point(speed, Double.valueOf(split[1])));
|
|
|
+ point5.add(new Point(speed, line.get(i).getY()));
|
|
|
if (speed >= 5 && speed < 10)
|
|
|
- point10.add(new Point(speed, Double.valueOf(split[1])));
|
|
|
+ point10.add(new Point(speed, line.get(i).getY()));
|
|
|
if (speed >= 10 && speed < 12)
|
|
|
- point12.add(new Point(speed, Double.valueOf(split[1])));
|
|
|
+ point12.add(new Point(speed, line.get(i).getY()));
|
|
|
if (speed >= 12 && speed <= 25)
|
|
|
- point25.add(new Point(speed, Double.valueOf(split[1])));
|
|
|
+ point25.add(new Point(speed, line.get(i).getY()));
|
|
|
+ if (speed >= 3 && speed <= 25){
|
|
|
+ point.add(new Point(speed, line.get(i).getY()));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//保证功率
|
|
|
+ List<Point> points = new ArrayList<>(); //3-25m
|
|
|
List<Point> points5 = new ArrayList<>(); //分段
|
|
|
List<Point> points10 = new ArrayList<>(); //分段
|
|
|
List<Point> points12 = new ArrayList<>(); //分段
|
|
@@ -394,6 +389,8 @@ public class DataFittingService {
|
|
|
points12.add(new Point(power.getSpeed(), power.getEnsurepower()));
|
|
|
if (power.getSpeed() >= 12 && power.getSpeed() <= 25)
|
|
|
points25.add(new Point(power.getSpeed(), power.getEnsurepower()));
|
|
|
+ if (power.getSpeed() >= 3 && power.getSpeed() <= 25)
|
|
|
+ points.add(new Point(power.getSpeed(), power.getEnsurepower()));
|
|
|
}
|
|
|
|
|
|
double maxp5 = list.stream().filter(f -> 5.0 == f.getSpeed()).collect(Collectors.toList()).get(0).getEnsurepower();
|
|
@@ -401,23 +398,22 @@ public class DataFittingService {
|
|
|
double maxp12 = list.stream().filter(f -> 12.0 == f.getSpeed()).collect(Collectors.toList()).get(0).getEnsurepower();
|
|
|
double maxp25 = list.stream().filter(f -> 25.0 == f.getSpeed()).collect(Collectors.toList()).get(0).getEnsurepower();
|
|
|
|
|
|
-
|
|
|
//曲线偏差率
|
|
|
+ double pcl = PowerFittingALG.curveDeviationRatio2(point, points, maxp25, 11);
|
|
|
double pcl5 = PowerFittingALG.curveDeviationRatio2(point5, points5, maxp5, 3);
|
|
|
double pcl10 = PowerFittingALG.curveDeviationRatio2(point10, points10, maxp10, 5);
|
|
|
double pcl12 = PowerFittingALG.curveDeviationRatio2(point12, points12, maxp12, 10);
|
|
|
double pcl25 = PowerFittingALG.curveDeviationRatio2(point25, points25, maxp25, 12);
|
|
|
|
|
|
- map.put("pcl5", Double.valueOf(df.format(pcl5)));
|
|
|
- map.put("pcl10", Double.valueOf(df.format(pcl10)));
|
|
|
- map.put("pcl12", Double.valueOf(df.format(pcl12)));
|
|
|
- map.put("pcl25", Double.valueOf(df.format(pcl25)));
|
|
|
+ obj.setPcratio(Double.valueOf(df.format(pcl)));
|
|
|
+ obj.setPc5ratio(Double.valueOf(df.format(pcl5)));
|
|
|
+ obj.setPc10ratio(Double.valueOf(df.format(pcl10)));
|
|
|
+ obj.setPc12ratio(Double.valueOf(df.format(pcl12)));
|
|
|
+ obj.setPc25ratio(Double.valueOf(df.format(pcl25)));
|
|
|
|
|
|
} catch (Exception e){
|
|
|
log.error("DataFittingService--dataCurveRatio",e);
|
|
|
}
|
|
|
-
|
|
|
- return map;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -441,7 +437,7 @@ public class DataFittingService {
|
|
|
String[] split = ls.get(i).split(",");
|
|
|
sjgl.add(new double[]{Double.valueOf(split[0]), Double.valueOf(split[1])});
|
|
|
}
|
|
|
- map.put("wtId", item.getWindturbine());
|
|
|
+ map.put("obj", item);
|
|
|
map.put("sjgl", sjgl);
|
|
|
result.add(map);
|
|
|
});
|
|
@@ -456,4 +452,52 @@ public class DataFittingService {
|
|
|
|
|
|
return map;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 统计并网时间 3-5m 5-10m 10-12m 12-25m 不运行
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Object dataFittingTime(String ids) {
|
|
|
+ List<Object> result = new ArrayList<>();
|
|
|
+ List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
|
|
|
+ if (list.size() == 0)
|
|
|
+ return result;
|
|
|
+
|
|
|
+ list.forEach(item -> {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ int[] time = new int[5];
|
|
|
+ String[] split = item.getPrepareid().split(",");//数据准备ID,获取文件
|
|
|
+ for (String id : split){
|
|
|
+ List<String> line = FileUtil.readFile(powerService.getById(id).getPath(), true);
|
|
|
+ timeTotal(time, line);
|
|
|
+ }
|
|
|
+ map.put("wtId", item.getWindturbine());
|
|
|
+ map.put("time", time);
|
|
|
+ result.add(map);
|
|
|
+ });
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void timeTotal(int[] time, List<String> line){
|
|
|
+ List<PowerPointData> list = new ArrayList<>();
|
|
|
+ double interval = DateUtil.getTimeDiff(line.get(1).split(",")[0], line.get(2).split(",")[0]); //两条数据的间隔时间
|
|
|
+ for (int i = 1; i < line.size(); i++){
|
|
|
+ list.add(new PowerPointData(line.get(i).split(",")));
|
|
|
+ }
|
|
|
+ for (PowerPointData item : list){
|
|
|
+ if (item.getSpeed() >= 3.0 && item.getSpeed() < 5.0 && item.getMxzt() == 2)
|
|
|
+ time[0] += interval;
|
|
|
+ if (item.getSpeed() >= 5.0 && item.getSpeed() < 10.0 && item.getMxzt() == 2)
|
|
|
+ time[1] += interval;
|
|
|
+ if (item.getSpeed() >= 10.0 && item.getSpeed() < 12.0 && item.getMxzt() == 2)
|
|
|
+ time[2] += interval;
|
|
|
+ if (item.getSpeed() >= 12.0 && item.getSpeed() <= 25.0 && item.getMxzt() == 2)
|
|
|
+ time[3] += interval;
|
|
|
+ if (item.getMxzt() != 2)
|
|
|
+ time[4] += interval;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|