|
@@ -33,11 +33,15 @@ public class PowerCurveFittingService {
|
|
|
private Integer dimension;
|
|
|
@Value("${curvefitting.scale}")
|
|
|
private Double scale;
|
|
|
-
|
|
|
+ @Value("${initialcode}")
|
|
|
+ private String initialcode;
|
|
|
public Map<String, Double> windturbineCapacity;
|
|
|
|
|
|
@Resource
|
|
|
private IProEconWtCurveFittingMonthService proEconWtCurveFittingMonthService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProEconWtCurveFittingYearService proEconWtCurveFittingYearService;
|
|
|
@Resource
|
|
|
private IProEconWtCurveFittingService proEconWtCurveFittingService;
|
|
|
|
|
@@ -52,6 +56,11 @@ public class PowerCurveFittingService {
|
|
|
@Resource
|
|
|
private IProEconWtPowerCurveFittingService proEconWtPowerCurveFittingService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private IProEconCurveFittYearSubService proEconCurveFittYearSubService;
|
|
|
+ @Resource
|
|
|
+ private IProEconCurveFittYearMainService proEconCurveFittYearMainService;
|
|
|
+
|
|
|
//inserttype 0表示正常拟合工作,1表示存值到windturbinePowerCurveFitting表
|
|
|
public void cureFitting(Date nowDate, Date begion, int insertType, List<ProBasicEquipment> wtls) throws Exception {
|
|
|
|
|
@@ -65,6 +74,8 @@ public class PowerCurveFittingService {
|
|
|
c.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
Date begin1 = c.getTime();
|
|
|
|
|
|
+ c.set(Calendar.MONTH, 0);
|
|
|
+ Date begin3 = c.getTime();
|
|
|
Date begin2 = DateUtils.addDays(current, -6);
|
|
|
|
|
|
Date end = DateUtils.truncDay(nowDate);
|
|
@@ -115,7 +126,19 @@ public class PowerCurveFittingService {
|
|
|
|
|
|
String pointIdFS = "";
|
|
|
if (wt.getWindpowerstationId().contains("GDC")) { //测风塔70米风速
|
|
|
- pointIdFS = windturbinetestingpointnewMap.get(ContantXk.FCCFTFS70).getNemCode();
|
|
|
+
|
|
|
+ if (windturbinetestingpointnewMap.containsKey(ContantXk.FCCFTFS70)) {
|
|
|
+ ProBasicEquipmentPoint point = windturbinetestingpointnewMap.get(ContantXk.FCCFTFS70);
|
|
|
+
|
|
|
+ if (StringUtils.notEmp(point.getNemCode()) && !point.getNemCode().equals(initialcode)) {
|
|
|
+ pointIdFS = windturbinetestingpointnewMap.get(ContantXk.FCCFTFS70).getNemCode();
|
|
|
+ } else {
|
|
|
+ pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
} else { //设备风速
|
|
|
pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
|
|
@@ -156,6 +179,9 @@ public class PowerCurveFittingService {
|
|
|
curveFittingBuilder(begin1, end, dimension, scale, windMap.get(key).getPointIdGL(), windMap.get(key).getPointIdFS(), windMap.get(key).getPointIdZT(), windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), key);
|
|
|
//拟合日功率曲线
|
|
|
curveFittingBuilder(begin2, end, dimension, scale, windMap.get(key).getPointIdGL(), windMap.get(key).getPointIdFS(), windMap.get(key).getPointIdZT(), windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), key);
|
|
|
+ //拟合年功率曲线
|
|
|
+ curveFittingBuilder(begin3, end, dimension, scale, windMap.get(key).getPointIdGL(), windMap.get(key).getPointIdFS(), windMap.get(key).getPointIdZT(), windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), key);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
for (String key : windMap.keySet()) {
|
|
@@ -165,21 +191,28 @@ public class PowerCurveFittingService {
|
|
|
modelpower = windturbineCapacity.get(key);
|
|
|
}
|
|
|
|
|
|
+// //年的上月
|
|
|
+ List<PointVo> yearLastMonthPoints = new ArrayList<PointVo>();
|
|
|
+// //年的去年同期
|
|
|
+ List<PointVo> yearLastYearPoints = new ArrayList<PointVo>();
|
|
|
+// //年标准功率
|
|
|
+ List<PointVo> yearStandardPoints = new ArrayList<PointVo>();
|
|
|
+
|
|
|
|
|
|
//月的上月
|
|
|
- List<PointVo> monthPoints = new ArrayList<PointVo>();
|
|
|
+ List<PointVo> monthLastMonthPoints = new ArrayList<PointVo>();
|
|
|
//月的去年同期
|
|
|
- List<PointVo> yearPoints = new ArrayList<PointVo>();
|
|
|
+ List<PointVo> monthLastYearPoints = new ArrayList<PointVo>();
|
|
|
//月标准功率
|
|
|
- List<PointVo> standardPoints = new ArrayList<PointVo>();
|
|
|
+ List<PointVo> monthStandardPoints = new ArrayList<PointVo>();
|
|
|
|
|
|
|
|
|
//日的昨天
|
|
|
- List<PointVo> monthdayPoints = new ArrayList<PointVo>();
|
|
|
+ List<PointVo> dayLastMonthPoints = new ArrayList<PointVo>();
|
|
|
//日的去年同期
|
|
|
- List<PointVo> yeardayPoints = new ArrayList<PointVo>();
|
|
|
+ List<PointVo> dayLastYearPoints = new ArrayList<PointVo>();
|
|
|
//日标准功率
|
|
|
- List<PointVo> standarddayPoints = new ArrayList<PointVo>();
|
|
|
+ List<PointVo> dayStandardPoints = new ArrayList<PointVo>();
|
|
|
|
|
|
//保证功率
|
|
|
List<PointVo> bzglpowerPoints = new ArrayList<PointVo>();
|
|
@@ -189,8 +222,8 @@ public class PowerCurveFittingService {
|
|
|
String standardId = CacheContext.wtstandardmap.get(key);
|
|
|
if (StringUtils.notEmp(standardId)) {
|
|
|
if (windMap.containsKey(key)) {
|
|
|
- standardPoints = windMap.get(standardId).getYsjglPoints();
|
|
|
- standarddayPoints = windMap.get(standardId).getRsjglPoints();
|
|
|
+ monthStandardPoints = windMap.get(standardId).getYsjglPoints();
|
|
|
+ dayStandardPoints = windMap.get(standardId).getRsjglPoints();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -204,36 +237,48 @@ public class PowerCurveFittingService {
|
|
|
String stringyear3 = String.valueOf(year3);
|
|
|
String stringmonth3 = String.valueOf(month3);
|
|
|
|
|
|
+ /*********************************************年曲线偏差上个月和上一年记录**********************************************************/
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconWtCurveFittingYear> wcfyls = proEconWtCurveFittingYearService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
|
|
|
+ i.getYear().equals(stringyear3)).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //与轶总的原始代码对比不一致,新增代码修改测试
|
|
|
+ yearBuildPoints(wcfyls, yearLastMonthPoints);
|
|
|
+ yearLastYearPoints = yearLastMonthPoints;
|
|
|
+
|
|
|
+/*********************************************年曲线偏差上个月和上一年记录**********************************************************/
|
|
|
+/*********************************************月曲线偏差上个月和上一年记录**********************************************************/
|
|
|
|
|
|
List<ProEconWtCurveFittingMonth> wcfmls = proEconWtCurveFittingMonthService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
|
|
|
i.getYear().equals(stringyear2) && i.getMonth().equals(stringmonth2)).sorted(Comparator.comparing(ProEconWtCurveFittingMonth::getSpeed)).collect(Collectors.toList());
|
|
|
|
|
|
+ monthBuildPoints(wcfmls, monthLastMonthPoints);
|
|
|
|
|
|
- monthBuildPoints(wcfmls, monthPoints);
|
|
|
wcfmls = null;
|
|
|
-
|
|
|
wcfmls = proEconWtCurveFittingMonthService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
|
|
|
i.getYear().equals(stringyear3) && i.getMonth().equals(stringmonth3)).collect(Collectors.toList());
|
|
|
wcfmls.sort(Comparator.comparing(ProEconWtCurveFittingMonth::getSpeed));
|
|
|
|
|
|
- monthBuildPoints(wcfmls, yearPoints);
|
|
|
-
|
|
|
+ monthBuildPoints(wcfmls, monthLastYearPoints);
|
|
|
+/*********************************************月曲线偏差上个月和上一年记录**********************************************************/
|
|
|
+/*********************************************日曲线偏差上个月和上一年记录**********************************************************/
|
|
|
Date d1 = DateUtils.addDays(current, -1);
|
|
|
- Date d2 = DateUtils.addDays(current, -1);
|
|
|
+ Date d2 = DateUtils.addYears(current, -1);
|
|
|
|
|
|
List<ProEconWtCurveFitting> wcfls = proEconWtCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
|
|
|
i.getRecordDate().compareTo(d1) == 0).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
- dayBuildPoints(wcfls, monthdayPoints);
|
|
|
+ dayBuildPoints(wcfls, dayLastMonthPoints);
|
|
|
|
|
|
wcfls = null;
|
|
|
wcfls = proEconWtCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
|
|
|
i.getRecordDate().compareTo(d2) == 0).collect(Collectors.toList());
|
|
|
|
|
|
-
|
|
|
- dayBuildPoints(wcfls, monthPoints);
|
|
|
-
|
|
|
+ //与轶总的原始代码对比不一致,临时修改测试
|
|
|
+ dayBuildPoints(wcfls, dayLastMonthPoints);
|
|
|
+/*********************************************日曲线偏差上个月和上一年记录**********************************************************/
|
|
|
if (CacheContext.wtmap.containsKey(key)) {
|
|
|
String modelid = CacheContext.wtmap.get(key).getModelId();
|
|
|
if (StringUtils.notEmp(modelid)) {
|
|
@@ -249,90 +294,128 @@ public class PowerCurveFittingService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+/*********************************************年曲线偏差记录**********************************************************/
|
|
|
|
|
|
+/*********************************************当年曲线偏差记录**********************************************************/
|
|
|
+ Optional<ProEconCurveFittYearMain> cfmyearo = proEconCurveFittYearMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
|
|
|
+ && i.getYear().equals(stringyear)).findFirst();
|
|
|
+ ProEconCurveFittYearMain cfmyear = null;
|
|
|
+ if (cfmyearo.isPresent()) {
|
|
|
+ cfmyear = cfmyearo.get();
|
|
|
|
|
|
- Optional<ProEconCurveFittMonthMain> cfmmo = proEconCurveFittMonthMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
|
|
|
+ QueryWrapper<ProEconCurveFittMonthMain> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("id", cfmyear.getId());
|
|
|
+ proEconCurveFittMonthMainService.remove(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ cfmyear = new ProEconCurveFittYearMain();
|
|
|
+ cfmyear.setWindturbineId(key);
|
|
|
+ cfmyear.setYear(String.valueOf(year));
|
|
|
+
|
|
|
+
|
|
|
+ //年---实际/最优
|
|
|
+ cfmyear.setDeviationRate1((Double) pcl(windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), modelpower));
|
|
|
+ //年---实际/保证
|
|
|
+ cfmyear.setDeviationRate2((Double) pcl(windMap.get(key).getNsjglPoints(), bzglpowerPoints, modelpower));
|
|
|
+ //年---最优/保证
|
|
|
+ cfmyear.setDeviationRate3((Double) pcl(windMap.get(key).getNzyglPoints(), bzglpowerPoints, modelpower));
|
|
|
+ //年---实际/上月实际
|
|
|
+ cfmyear.setMonthDeviationRate((Double) pcl(windMap.get(key).getNsjglPoints(), yearLastMonthPoints, modelpower));
|
|
|
+ //年---实际/同期实际
|
|
|
+ cfmyear.setYearDeviationRate((Double) pcl(windMap.get(key).getNsjglPoints(), yearLastYearPoints, modelpower));
|
|
|
+ //年---实际/标杆实际
|
|
|
+ cfmyear.setStandardDeviationRate((Double) pcl(windMap.get(key).getNsjglPoints(), yearStandardPoints, modelpower));
|
|
|
+
|
|
|
+
|
|
|
+ proEconCurveFittYearMainService.save(cfmyear);
|
|
|
+
|
|
|
+/*********************************************当年曲线偏差记录**********************************************************/
|
|
|
+/*********************************************当月曲线偏差记录**********************************************************/
|
|
|
+ Optional<ProEconCurveFittMonthMain> cfmmontho = proEconCurveFittMonthMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
|
|
|
&& i.getYear().equals(stringyear) && i.getMonth().equals(stringmonth)).findFirst();
|
|
|
- ProEconCurveFittMonthMain cfmm = null;
|
|
|
- if (cfmmo.isPresent()) {
|
|
|
- cfmm = cfmmo.get();
|
|
|
+ ProEconCurveFittMonthMain cfmmonth = null;
|
|
|
+ if (cfmmontho.isPresent()) {
|
|
|
+ cfmmonth = cfmmontho.get();
|
|
|
|
|
|
QueryWrapper<ProEconCurveFittMonthMain> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("id", cfmm.getId());
|
|
|
+ wrapper.eq("id", cfmmonth.getId());
|
|
|
proEconCurveFittMonthMainService.remove(wrapper);
|
|
|
}
|
|
|
|
|
|
|
|
|
- cfmm = new ProEconCurveFittMonthMain();
|
|
|
- cfmm.setWindturbineId(key);
|
|
|
- cfmm.setYear(String.valueOf(year));
|
|
|
- cfmm.setMonth(String.valueOf(month));
|
|
|
+ cfmmonth = new ProEconCurveFittMonthMain();
|
|
|
+ cfmmonth.setWindturbineId(key);
|
|
|
+ cfmmonth.setYear(String.valueOf(year));
|
|
|
+ cfmmonth.setMonth(String.valueOf(month));
|
|
|
|
|
|
//月---实际/最优
|
|
|
- cfmm.setDeviationRate1((Double) pcl(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower));
|
|
|
+ cfmmonth.setDeviationRate1((Double) pcl(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower));
|
|
|
//月---实际/保证
|
|
|
- cfmm.setDeviationRate2((Double) pcl(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower));
|
|
|
+ cfmmonth.setDeviationRate2((Double) pcl(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower));
|
|
|
//月---最优/保证
|
|
|
- cfmm.setDeviationRate3((Double) pcl(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower));
|
|
|
+ cfmmonth.setDeviationRate3((Double) pcl(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower));
|
|
|
//月---实际/上月实际
|
|
|
- cfmm.setMonthDeviationRate((Double) pcl(windMap.get(key).getYsjglPoints(), monthPoints, modelpower));
|
|
|
+ cfmmonth.setMonthDeviationRate((Double) pcl(windMap.get(key).getYsjglPoints(), monthLastMonthPoints, modelpower));
|
|
|
//月---实际/同期实际
|
|
|
- cfmm.setYearDeviationRate((Double) pcl(windMap.get(key).getYsjglPoints(), yearPoints, modelpower));
|
|
|
+ cfmmonth.setYearDeviationRate((Double) pcl(windMap.get(key).getYsjglPoints(), monthLastYearPoints, modelpower));
|
|
|
//月---实际/标杆实际
|
|
|
- cfmm.setStandardDeviationRate((Double) pcl(windMap.get(key).getYsjglPoints(), standardPoints, modelpower));
|
|
|
+ cfmmonth.setStandardDeviationRate((Double) pcl(windMap.get(key).getYsjglPoints(), monthStandardPoints, modelpower));
|
|
|
|
|
|
|
|
|
- proEconCurveFittMonthMainService.save(cfmm);
|
|
|
+ proEconCurveFittMonthMainService.save(cfmmonth);
|
|
|
|
|
|
- Optional<ProEconCurveFittingMain> cfmo = proEconCurveFittingMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
|
|
|
+ /*********************************************当月曲线偏差记录**********************************************************/
|
|
|
+ /*********************************************当日曲线偏差记录**********************************************************/
|
|
|
+ Optional<ProEconCurveFittingMain> cfmdayo = proEconCurveFittingMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
|
|
|
&& i.getRecordDate().compareTo(current) == 0).findFirst();
|
|
|
- ProEconCurveFittingMain cfm = null;
|
|
|
+ ProEconCurveFittingMain cfmday = null;
|
|
|
|
|
|
- if (cfmo.isPresent()) {
|
|
|
- cfm = cfmo.get();
|
|
|
+ if (cfmdayo.isPresent()) {
|
|
|
+ cfmday = cfmdayo.get();
|
|
|
QueryWrapper<ProEconCurveFittingMain> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("id", cfm.getId());
|
|
|
+ wrapper.eq("id", cfmday.getId());
|
|
|
proEconCurveFittingMainService.remove(wrapper);
|
|
|
}
|
|
|
|
|
|
- cfm = new ProEconCurveFittingMain();
|
|
|
- cfm.setWindturbineId(key);
|
|
|
- cfm.setRecordDate(current);
|
|
|
+ cfmday = new ProEconCurveFittingMain();
|
|
|
+ cfmday.setWindturbineId(key);
|
|
|
+ cfmday.setRecordDate(current);
|
|
|
|
|
|
|
|
|
//日---实际/最优
|
|
|
- cfm.setDeviationRate1((Double) pcl(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower));
|
|
|
+ cfmday.setDeviationRate1((Double) pcl(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower));
|
|
|
//日---实际/保证
|
|
|
- cfm.setDeviationRate2((Double) pcl(windMap.get(key).getRsjglPoints(), bzglpowerPoints, modelpower));
|
|
|
+ cfmday.setDeviationRate2((Double) pcl(windMap.get(key).getRsjglPoints(), bzglpowerPoints, modelpower));
|
|
|
//日---最优/保证
|
|
|
- cfm.setDeviationRate3((Double) pcl(windMap.get(key).getRzyglPoints(), bzglpowerPoints, modelpower));
|
|
|
+ cfmday.setDeviationRate3((Double) pcl(windMap.get(key).getRzyglPoints(), bzglpowerPoints, modelpower));
|
|
|
//日---实际/上日实际
|
|
|
- cfm.setMonthDeviationRate((Double) pcl(windMap.get(key).getRsjglPoints(), monthdayPoints, modelpower));
|
|
|
+ cfmday.setMonthDeviationRate((Double) pcl(windMap.get(key).getRsjglPoints(), dayLastMonthPoints, modelpower));
|
|
|
//日---实际/同期实际
|
|
|
- cfm.setYearDeviationRate((Double) pcl(windMap.get(key).getRsjglPoints(), yeardayPoints, modelpower));
|
|
|
+ cfmday.setYearDeviationRate((Double) pcl(windMap.get(key).getRsjglPoints(), dayLastYearPoints, modelpower));
|
|
|
//日---实际/标杆实际
|
|
|
- cfm.setStandardDeviationRate((Double) pcl(windMap.get(key).getRsjglPoints(), standarddayPoints, modelpower));
|
|
|
+ cfmday.setStandardDeviationRate((Double) pcl(windMap.get(key).getRsjglPoints(), dayStandardPoints, modelpower));
|
|
|
|
|
|
|
|
|
- proEconCurveFittingMainService.save(cfm);
|
|
|
-
|
|
|
- pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 3, bzglpowerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
- pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 4, bzglpowerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
- pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 5, bzglpowerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
- pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 6, bzglpowerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
- pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 7, bzglpowerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
- pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 8, bzglpowerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
- pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 9, bzglpowerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
- pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 10, bzglpowerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
- pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 11, bzglpowerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
- pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 12, bzglpowerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
- pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 13, bzglpowerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
+ proEconCurveFittingMainService.save(cfmday);
|
|
|
+ /*********************************************当日曲线偏差记录**********************************************************/
|
|
|
+ pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 3, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
|
|
|
+ pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 4, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
|
|
|
+ pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 5, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
|
|
|
+ pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 6, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
|
|
|
+ pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 7, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
|
|
|
+ pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 8, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
|
|
|
+ pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 9, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
|
|
|
+ pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 10, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
|
|
|
+ pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 11, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
|
|
|
+ pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 12, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
|
|
|
+ pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 13, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
|
|
|
|
|
|
|
|
|
if (insertType == 0) {
|
|
|
- insertPoints(current, stringyear, stringmonth, windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), key);
|
|
|
+ insertPoints(current, stringyear, stringmonth, windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), key);
|
|
|
} else {
|
|
|
- insertPoints2(current, stringyear, stringmonth, windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), key);
|
|
|
+ insertPoints2(current, stringyear, stringmonth, windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), key);
|
|
|
}
|
|
|
logger.info(key);
|
|
|
//
|
|
@@ -345,46 +428,86 @@ public class PowerCurveFittingService {
|
|
|
}
|
|
|
|
|
|
public void pLCBuild(String key, String stringyear, String stringmonth, Date current, Map<String, CureFittingVo> windMap, Double modelpower, double speed,
|
|
|
- List<PointVo> bzglpowerPoints, List<PointVo> monthPoints, List<PointVo> yearPoints, List<PointVo> standardPoints, List<PointVo> monthdayPoints, List<PointVo> yeardayPoints, List<PointVo> standarddayPoints) {
|
|
|
+ List<PointVo> bzglpowerPoints, List<PointVo> monthLastMonthPoints, List<PointVo> monthLastYearPoints, List<PointVo> monthStandardPoints,
|
|
|
+ List<PointVo> dayLastMonthPoints, List<PointVo> dayLastYearPoints, List<PointVo> dayStandardPoints,
|
|
|
+ List<PointVo> yearLastMonthPoints, List<PointVo> yearLastYearPoints, List<PointVo> yearStandardPoints) {
|
|
|
|
|
|
String speedStr = String.valueOf(speed);
|
|
|
|
|
|
+ /*********************************************当年曲线偏差子表记录**********************************************************/
|
|
|
+
|
|
|
+ Optional<ProEconCurveFittYearSub> cfmsyearo = proEconCurveFittYearSubService.list().stream().filter(i -> i.getWindturbineId().equals(key)
|
|
|
+ && i.getYear().equals(stringyear) && i.getSpeed().equals(speedStr)).findFirst();
|
|
|
+ ProEconCurveFittYearSub cfmsyear = null;
|
|
|
+
|
|
|
+ if (cfmsyearo.isPresent()) {
|
|
|
+ cfmsyear = cfmsyearo.get();
|
|
|
|
|
|
- Optional<ProEconCurveFittMonthSub> cfmmso = proEconCurveFittMonthSubService.list().stream().filter(i -> i.getWindturbineId().equals(key)
|
|
|
+ QueryWrapper<ProEconCurveFittYearSub> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("id", cfmsyear.getId());
|
|
|
+ proEconCurveFittYearSubService.remove(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ cfmsyear = new ProEconCurveFittYearSub();
|
|
|
+ cfmsyear.setWindturbineId(key);
|
|
|
+ cfmsyear.setYear(stringyear);
|
|
|
+ cfmsyear.setSpeed(String.valueOf(speed));
|
|
|
+
|
|
|
+ proEconCurveFittYearSubService.save(cfmsyear);
|
|
|
+
|
|
|
+ //年---实际/最优
|
|
|
+ cfmsyear.setDeviationRate1((Double) pcl2(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower, speed));
|
|
|
+ //年---实际/保证
|
|
|
+ cfmsyear.setDeviationRate2((Double) pcl2(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower, speed));
|
|
|
+ //年---最优/保证
|
|
|
+ cfmsyear.setDeviationRate3((Double) pcl2(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower, speed));
|
|
|
+ //年---实际/上月实际
|
|
|
+ cfmsyear.setMonthDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), monthLastMonthPoints, modelpower, speed));
|
|
|
+ //年---实际/同期实际
|
|
|
+ cfmsyear.setYearDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), monthLastYearPoints, modelpower, speed));
|
|
|
+ //年---实际/标杆实际
|
|
|
+ cfmsyear.setStandardDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), monthStandardPoints, modelpower, speed));
|
|
|
+
|
|
|
+ proEconCurveFittYearSubService.save(cfmsyear);
|
|
|
+/*********************************************当年曲线偏差子表记录**********************************************************/
|
|
|
+/*********************************************当月曲线偏差子表记录**********************************************************/
|
|
|
+
|
|
|
+ Optional<ProEconCurveFittMonthSub> cfmsmontho = proEconCurveFittMonthSubService.list().stream().filter(i -> i.getWindturbineId().equals(key)
|
|
|
&& i.getYear().equals(stringyear) && i.getMonth().equals(stringmonth) && i.getSpeed().equals(speedStr)).findFirst();
|
|
|
- ProEconCurveFittMonthSub cfmms = null;
|
|
|
+ ProEconCurveFittMonthSub cfmsmonth = null;
|
|
|
|
|
|
- if (cfmmso.isPresent()) {
|
|
|
- cfmms = cfmmso.get();
|
|
|
+ if (cfmsmontho.isPresent()) {
|
|
|
+ cfmsmonth = cfmsmontho.get();
|
|
|
|
|
|
QueryWrapper<ProEconCurveFittMonthSub> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("id", cfmms.getId());
|
|
|
+ wrapper.eq("id", cfmsmonth.getId());
|
|
|
proEconCurveFittMonthSubService.remove(wrapper);
|
|
|
}
|
|
|
|
|
|
- cfmms = new ProEconCurveFittMonthSub();
|
|
|
- cfmms.setWindturbineId(key);
|
|
|
- cfmms.setYear(stringyear);
|
|
|
- cfmms.setMonth(stringmonth);
|
|
|
- cfmms.setSpeed(String.valueOf(speed));
|
|
|
+ cfmsmonth = new ProEconCurveFittMonthSub();
|
|
|
+ cfmsmonth.setWindturbineId(key);
|
|
|
+ cfmsmonth.setYear(stringyear);
|
|
|
+ cfmsmonth.setMonth(stringmonth);
|
|
|
+ cfmsmonth.setSpeed(String.valueOf(speed));
|
|
|
|
|
|
- proEconCurveFittMonthSubService.save(cfmms);
|
|
|
+ proEconCurveFittMonthSubService.save(cfmsmonth);
|
|
|
|
|
|
//月---实际/最优
|
|
|
- cfmms.setDeviationRate1((Double) pcl2(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower, speed));
|
|
|
+ cfmsmonth.setDeviationRate1((Double) pcl2(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower, speed));
|
|
|
//月---实际/保证
|
|
|
- cfmms.setDeviationRate2((Double) pcl2(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower, speed));
|
|
|
+ cfmsmonth.setDeviationRate2((Double) pcl2(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower, speed));
|
|
|
//月---最优/保证
|
|
|
- cfmms.setDeviationRate3((Double) pcl2(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower, speed));
|
|
|
+ cfmsmonth.setDeviationRate3((Double) pcl2(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower, speed));
|
|
|
//月---实际/上月实际
|
|
|
- cfmms.setMonthDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), monthPoints, modelpower, speed));
|
|
|
+ cfmsmonth.setMonthDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), monthLastMonthPoints, modelpower, speed));
|
|
|
//月---实际/同期实际
|
|
|
- cfmms.setYearDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), yearPoints, modelpower, speed));
|
|
|
+ cfmsmonth.setYearDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), monthLastYearPoints, modelpower, speed));
|
|
|
//月---实际/标杆实际
|
|
|
- cfmms.setStandardDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), standardPoints, modelpower, speed));
|
|
|
-
|
|
|
- proEconCurveFittMonthSubService.save(cfmms);
|
|
|
+ cfmsmonth.setStandardDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), monthStandardPoints, modelpower, speed));
|
|
|
|
|
|
+ proEconCurveFittMonthSubService.save(cfmsmonth);
|
|
|
+/*********************************************当月曲线偏差子表记录**********************************************************/
|
|
|
+/*********************************************当日曲线偏差子表记录**********************************************************/
|
|
|
Optional<ProEconCurveFittingSub> cfmso = proEconCurveFittingSubService.list().stream().filter(i -> i.getWindturbineId().equals(key)
|
|
|
&& i.getRecordDate().compareTo(current) == 0 && i.getSpeed().equals(speedStr)).findFirst();
|
|
|
ProEconCurveFittingSub cfms = null;
|
|
@@ -409,28 +532,95 @@ public class PowerCurveFittingService {
|
|
|
//日---最优/保证
|
|
|
cfms.setDeviationRate3((Double) pcl2(windMap.get(key).getRzyglPoints(), bzglpowerPoints, modelpower, speed));
|
|
|
//日---实际/上日实际
|
|
|
- cfms.setMonthDeviationRate((Double) pcl2(windMap.get(key).getRsjglPoints(), monthdayPoints, modelpower, speed));
|
|
|
+ cfms.setMonthDeviationRate((Double) pcl2(windMap.get(key).getRsjglPoints(), dayLastMonthPoints, modelpower, speed));
|
|
|
//日---实际/同期实际
|
|
|
- cfms.setYearDeviationRate((Double) pcl2(windMap.get(key).getRsjglPoints(), yeardayPoints, modelpower, speed));
|
|
|
+ cfms.setYearDeviationRate((Double) pcl2(windMap.get(key).getRsjglPoints(), dayLastYearPoints, modelpower, speed));
|
|
|
//日---实际/标杆实际
|
|
|
- cfms.setStandardDeviationRate((Double) pcl2(windMap.get(key).getRsjglPoints(), standarddayPoints, modelpower, speed));
|
|
|
+ cfms.setStandardDeviationRate((Double) pcl2(windMap.get(key).getRsjglPoints(), dayStandardPoints, modelpower, speed));
|
|
|
|
|
|
proEconCurveFittingSubService.save(cfms);
|
|
|
+/*********************************************当日曲线偏差子表记录**********************************************************/
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void insertPoints(Date current, String year, String month, List<PointVo> pointsF1, List<PointVo> pointsFF1, List<PointVo> pointsF2, List<PointVo> pointsFF2, String windturbineId) {
|
|
|
+ private void insertPoints(Date current, String year, String month, List<PointVo> monthSjglls, List<PointVo> monthZyglls, List<PointVo> daySjglls, List<PointVo> dayZyglls, List<PointVo> yearSjglls, List<PointVo> yearZyglls, String windturbineId) {
|
|
|
+ /*********************************************当年曲线偏差记录**********************************************************/
|
|
|
+ List<Integer> wtcfmyearidls = proEconWtCurveFittingYearService.list().stream().filter(i -> i.getWindturbineId().equals(windturbineId) &&
|
|
|
+ i.getYear().equals(year)).map(i -> i.getId()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (int i = 0; i < wtcfmyearidls.size(); i++) {
|
|
|
+ proEconWtCurveFittingYearService.removeByIds(wtcfmyearidls);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (yearSjglls.size() == yearZyglls.size()) {
|
|
|
+ for (int i = 0; i < yearSjglls.size(); i++) {
|
|
|
+ ProEconWtCurveFittingYear item = new ProEconWtCurveFittingYear();
|
|
|
+
|
|
|
+ item.setWindturbineId(windturbineId);
|
|
|
+ if (CacheContext.wtmap.containsKey(windturbineId)) {
|
|
|
+ ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
|
|
|
+ if (wt.getWindpowerstationId().contains("GDC")) {
|
|
|
+ continue;
|
|
|
+ // item.SPEED = Double.Truncate((Double)pointsF1[i].X);
|
|
|
+ } else {
|
|
|
+ item.setSpeed(yearSjglls.get(i).getX());
|
|
|
+
|
|
|
+ }
|
|
|
+ item.setActualPower(yearSjglls.get(i).getY());
|
|
|
+ item.setOptimalPower(yearZyglls.get(i).getY());
|
|
|
+ item.setYear(String.valueOf(year));
|
|
|
+
|
|
|
+ proEconWtCurveFittingYearService.save(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ logger.warn(String.format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, yearSjglls.size(), yearZyglls.size()));
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i < yearSjglls.size(); i++) {
|
|
|
+ ProEconWtCurveFittingYear item = new ProEconWtCurveFittingYear();
|
|
|
+ item.setWindturbineId(windturbineId);
|
|
|
+ if (CacheContext.wtmap.containsKey(windturbineId)) {
|
|
|
+
|
|
|
+ ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
|
|
|
+ if (wt.getWindpowerstationId().contains("GDC")) {
|
|
|
+ continue;
|
|
|
+ //item.SPEED = Double.Truncate((Double)pointsF1[i].X);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ item.setSpeed(yearSjglls.get(i).getX());
|
|
|
+ }
|
|
|
+ item.setActualPower(yearSjglls.get(i).getY());
|
|
|
|
|
|
- List<Integer> wtcfmidls = proEconWtCurveFittingMonthService.list().stream().filter(i -> i.getWindturbineId().equals(windturbineId) &&
|
|
|
+ int finalI = i;
|
|
|
+ OptionalDouble op = yearZyglls.stream().filter(x -> x.getX() == yearSjglls.get(finalI).getX()).mapToDouble(x -> x.getY()).findFirst();
|
|
|
+
|
|
|
+ if (op.isPresent()) {
|
|
|
+ item.setOptimalPower(op.getAsDouble());
|
|
|
+ } else {
|
|
|
+ item.setOptimalPower(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ item.setYear(String.valueOf(year));
|
|
|
+
|
|
|
+ proEconWtCurveFittingYearService.save(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*********************************************当年曲线偏差记录**********************************************************/
|
|
|
+ /*********************************************当月曲线偏差记录**********************************************************/
|
|
|
+ List<Integer> wtcfmmonthidls = proEconWtCurveFittingMonthService.list().stream().filter(i -> i.getWindturbineId().equals(windturbineId) &&
|
|
|
i.getYear().equals(year) && i.getMonth().equals(month)).map(i -> i.getId()).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < wtcfmidls.size(); i++) {
|
|
|
- proEconWtCurveFittingMonthService.removeByIds(wtcfmidls);
|
|
|
+ for (int i = 0; i < wtcfmmonthidls.size(); i++) {
|
|
|
+ proEconWtCurveFittingMonthService.removeByIds(wtcfmmonthidls);
|
|
|
}
|
|
|
|
|
|
- if (pointsF1.size() == pointsFF1.size()) {
|
|
|
- for (int i = 0; i < pointsF1.size(); i++) {
|
|
|
+ if (monthSjglls.size() == monthZyglls.size()) {
|
|
|
+ for (int i = 0; i < monthSjglls.size(); i++) {
|
|
|
ProEconWtCurveFittingMonth item = new ProEconWtCurveFittingMonth();
|
|
|
|
|
|
item.setWindturbineId(windturbineId);
|
|
@@ -440,11 +630,11 @@ public class PowerCurveFittingService {
|
|
|
continue;
|
|
|
// item.SPEED = Double.Truncate((Double)pointsF1[i].X);
|
|
|
} else {
|
|
|
- item.setSpeed(pointsF1.get(i).getX());
|
|
|
+ item.setSpeed(monthSjglls.get(i).getX());
|
|
|
|
|
|
}
|
|
|
- item.setActualPower(pointsF1.get(i).getY());
|
|
|
- item.setOptimalPower(pointsFF1.get(i).getY());
|
|
|
+ item.setActualPower(monthSjglls.get(i).getY());
|
|
|
+ item.setOptimalPower(monthZyglls.get(i).getY());
|
|
|
item.setYear(String.valueOf(year));
|
|
|
item.setMonth(String.valueOf(month));
|
|
|
|
|
@@ -453,10 +643,10 @@ public class PowerCurveFittingService {
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
- logger.warn(String.format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, pointsF1.size(), pointsFF1.size()));
|
|
|
+ logger.warn(String.format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, monthSjglls.size(), monthZyglls.size()));
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < pointsF1.size(); i++) {
|
|
|
+ for (int i = 0; i < monthSjglls.size(); i++) {
|
|
|
ProEconWtCurveFittingMonth item = new ProEconWtCurveFittingMonth();
|
|
|
item.setWindturbineId(windturbineId);
|
|
|
if (CacheContext.wtmap.containsKey(windturbineId)) {
|
|
@@ -467,12 +657,12 @@ public class PowerCurveFittingService {
|
|
|
//item.SPEED = Double.Truncate((Double)pointsF1[i].X);
|
|
|
} else {
|
|
|
|
|
|
- item.setSpeed(pointsF1.get(i).getX());
|
|
|
+ item.setSpeed(monthSjglls.get(i).getX());
|
|
|
}
|
|
|
- item.setActualPower(pointsF1.get(i).getY());
|
|
|
+ item.setActualPower(monthSjglls.get(i).getY());
|
|
|
|
|
|
int finalI = i;
|
|
|
- OptionalDouble op = pointsFF1.stream().filter(x -> x.getX() == pointsF1.get(finalI).getX()).mapToDouble(x -> x.getY()).findFirst();
|
|
|
+ OptionalDouble op = monthZyglls.stream().filter(x -> x.getX() == monthSjglls.get(finalI).getX()).mapToDouble(x -> x.getY()).findFirst();
|
|
|
|
|
|
if (op.isPresent()) {
|
|
|
item.setOptimalPower(op.getAsDouble());
|
|
@@ -488,8 +678,8 @@ public class PowerCurveFittingService {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ /*********************************************当月曲线偏差记录**********************************************************/
|
|
|
+ /*********************************************当日曲线偏差记录**********************************************************/
|
|
|
List<Integer> wtcfidls = proEconWtCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(windturbineId) &&
|
|
|
i.getRecordDate().compareTo(current) == 0).map(ProEconWtCurveFitting::getId).collect(Collectors.toList());
|
|
|
|
|
@@ -498,8 +688,8 @@ public class PowerCurveFittingService {
|
|
|
proEconWtCurveFittingService.removeByIds(wtcfidls);
|
|
|
}
|
|
|
|
|
|
- if (pointsF2.size() == pointsFF2.size()) {
|
|
|
- for (int i = 0; i < pointsF2.size(); i++) {
|
|
|
+ if (daySjglls.size() == dayZyglls.size()) {
|
|
|
+ for (int i = 0; i < daySjglls.size(); i++) {
|
|
|
ProEconWtCurveFitting item = new ProEconWtCurveFitting();
|
|
|
item.setWindturbineId(windturbineId);
|
|
|
|
|
@@ -509,17 +699,17 @@ public class PowerCurveFittingService {
|
|
|
continue;
|
|
|
// item.SPEED = Double.Truncate((Double)pointsF2[i].X);
|
|
|
} else {
|
|
|
- boolean l = String.valueOf(pointsF2.get(i).getX()).contains(".");
|
|
|
+ boolean l = String.valueOf(daySjglls.get(i).getX()).contains(".");
|
|
|
if (l) {
|
|
|
continue;
|
|
|
}
|
|
|
- item.setSpeed(pointsF2.get(i).getX());
|
|
|
+ item.setSpeed(daySjglls.get(i).getX());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
- item.setActualPower(pointsF2.get(i).getY());
|
|
|
- item.setOptimalPower(pointsFF2.get(i).getY());
|
|
|
+ item.setActualPower(daySjglls.get(i).getY());
|
|
|
+ item.setOptimalPower(dayZyglls.get(i).getY());
|
|
|
item.setRecordDate(current);
|
|
|
|
|
|
proEconWtCurveFittingService.save(item);
|
|
@@ -528,9 +718,9 @@ public class PowerCurveFittingService {
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
- logger.warn(String.format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, pointsF2.size(), pointsFF2.size()));
|
|
|
+ logger.warn(String.format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, daySjglls.size(), dayZyglls.size()));
|
|
|
|
|
|
- for (int i = 0; i < pointsF2.size(); i++) {
|
|
|
+ for (int i = 0; i < daySjglls.size(); i++) {
|
|
|
ProEconWtCurveFitting item = new ProEconWtCurveFitting();
|
|
|
item.setWindturbineId(windturbineId);
|
|
|
|
|
@@ -540,16 +730,16 @@ public class PowerCurveFittingService {
|
|
|
continue;
|
|
|
//item.SPEED = Double.Truncate((Double)pointsF2[i].X);
|
|
|
} else {
|
|
|
- boolean l = String.valueOf(pointsF2.get(i).getX()).contains(".");
|
|
|
+ boolean l = String.valueOf(daySjglls.get(i).getX()).contains(".");
|
|
|
if (l) {
|
|
|
continue;
|
|
|
}
|
|
|
- item.setSpeed(pointsF2.get(i).getX());
|
|
|
+ item.setSpeed(daySjglls.get(i).getX());
|
|
|
}
|
|
|
|
|
|
|
|
|
int finalI = i;
|
|
|
- OptionalDouble op = pointsFF2.stream().filter(x -> x.getX() == pointsF2.get(finalI).getX()).mapToDouble(x -> x.getY()).findFirst();
|
|
|
+ OptionalDouble op = dayZyglls.stream().filter(x -> x.getX() == daySjglls.get(finalI).getX()).mapToDouble(x -> x.getY()).findFirst();
|
|
|
|
|
|
if (op.isPresent()) {
|
|
|
item.setOptimalPower(op.getAsDouble());
|
|
@@ -557,17 +747,18 @@ public class PowerCurveFittingService {
|
|
|
item.setOptimalPower(0.0);
|
|
|
}
|
|
|
|
|
|
- item.setActualPower(pointsF2.get(i).getY());
|
|
|
+ item.setActualPower(daySjglls.get(i).getY());
|
|
|
item.setRecordDate(current);
|
|
|
proEconWtCurveFittingService.save(item);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ /*********************************************当日曲线偏差记录**********************************************************/
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void insertPoints2(Date current, String year, String month, List<PointVo> pointsF1, List<PointVo> pointsFF1, List<PointVo> pointsF2, List<PointVo> pointsFF2, String windturbineId) {
|
|
|
+ private void insertPoints2(Date current, String year, String month, List<PointVo> monthSjglls, List<PointVo> monthZyglls, List<PointVo> daySjglls, List<PointVo> dayZyglls, List<PointVo> yearSjglls, List<PointVo> yearZyglls, String windturbineId) {
|
|
|
|
|
|
|
|
|
List<Integer> wtpcfidls = proEconWtPowerCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(windturbineId)).map(i -> i.getId()).collect(Collectors.toList());
|
|
@@ -577,8 +768,8 @@ public class PowerCurveFittingService {
|
|
|
proEconWtPowerCurveFittingService.removeByIds(wtpcfidls);
|
|
|
}
|
|
|
|
|
|
- if (pointsF1.size() == pointsFF1.size()) {
|
|
|
- for (int i = 0; i < pointsF1.size(); i++) {
|
|
|
+ if (monthSjglls.size() == monthZyglls.size()) {
|
|
|
+ for (int i = 0; i < monthSjglls.size(); i++) {
|
|
|
ProEconWtPowerCurveFitting item = new ProEconWtPowerCurveFitting();
|
|
|
|
|
|
item.setWindturbineId(windturbineId);
|
|
@@ -590,16 +781,16 @@ public class PowerCurveFittingService {
|
|
|
continue;
|
|
|
// item.SPEED = Double.Truncate((Double)pointsF1[i].X);
|
|
|
} else {
|
|
|
- boolean l = String.valueOf(pointsF1.get(i).getX()).contains(".");
|
|
|
+ boolean l = String.valueOf(monthSjglls.get(i).getX()).contains(".");
|
|
|
if (l) {
|
|
|
continue;
|
|
|
}
|
|
|
- item.setSpeed(pointsF1.get(i).getX());
|
|
|
+ item.setSpeed(monthSjglls.get(i).getX());
|
|
|
}
|
|
|
|
|
|
|
|
|
- item.setActualPower(pointsF1.get(i).getY());
|
|
|
- item.setOptimalPower(pointsFF1.get(i).getY());
|
|
|
+ item.setActualPower(monthSjglls.get(i).getY());
|
|
|
+ item.setOptimalPower(monthZyglls.get(i).getY());
|
|
|
|
|
|
|
|
|
proEconWtPowerCurveFittingService.save(item);
|
|
@@ -608,9 +799,9 @@ public class PowerCurveFittingService {
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
- logger.warn(String.format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, pointsF1.size(), pointsFF1.size()));
|
|
|
+ logger.warn(String.format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, monthSjglls.size(), monthZyglls.size()));
|
|
|
|
|
|
- for (int i = 0; i < pointsF1.size(); i++) {
|
|
|
+ for (int i = 0; i < monthSjglls.size(); i++) {
|
|
|
ProEconWtPowerCurveFitting item = new ProEconWtPowerCurveFitting();
|
|
|
|
|
|
item.setWindturbineId(windturbineId);
|
|
@@ -622,17 +813,17 @@ public class PowerCurveFittingService {
|
|
|
continue;
|
|
|
//item.SPEED = Double.Truncate((Double)pointsF1[i].X);
|
|
|
} else {
|
|
|
- boolean l = String.valueOf(pointsF1.get(i).getX()).contains(".");
|
|
|
+ boolean l = String.valueOf(monthSjglls.get(i).getX()).contains(".");
|
|
|
if (l) {
|
|
|
continue;
|
|
|
}
|
|
|
- item.setSpeed(pointsF1.get(i).getX());
|
|
|
+ item.setSpeed(monthSjglls.get(i).getX());
|
|
|
}
|
|
|
|
|
|
|
|
|
- item.setActualPower(pointsF1.get(i).getY());
|
|
|
+ item.setActualPower(monthSjglls.get(i).getY());
|
|
|
int finalI = i;
|
|
|
- OptionalDouble op = pointsFF1.stream().filter(x -> x.getX() == pointsF1.get(finalI).getX()).mapToDouble(x -> x.getY()).findFirst();
|
|
|
+ OptionalDouble op = monthZyglls.stream().filter(x -> x.getX() == monthSjglls.get(finalI).getX()).mapToDouble(x -> x.getY()).findFirst();
|
|
|
|
|
|
if (op.isPresent()) {
|
|
|
item.setOptimalPower(op.getAsDouble());
|
|
@@ -648,6 +839,16 @@ public class PowerCurveFittingService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void yearBuildPoints(List<ProEconWtCurveFittingYear> data, List<PointVo> points) {
|
|
|
+ if (data != null) {
|
|
|
+ for (int i = 0; i < data.size(); i++) {
|
|
|
+ PointVo point = new PointVo();
|
|
|
+ point.setX(data.get(i).getSpeed());
|
|
|
+ point.setY(data.get(i).getActualPower());
|
|
|
+ points.add(point);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
private void monthBuildPoints(List<ProEconWtCurveFittingMonth> data, List<PointVo> points) {
|
|
|
if (data != null) {
|
|
@@ -713,7 +914,7 @@ public class PowerCurveFittingService {
|
|
|
double max = (double) modelpower;
|
|
|
for (PointVo point : points1) {
|
|
|
List<PointVo> item = points2.stream().filter(it -> it.getX() == point.getX()).collect(Collectors.toList());
|
|
|
- if (item != null && item.size() > 0 && item.get(0).getX() >= minSpeed && item.get(0).getX() < maxSpeed){
|
|
|
+ if (item != null && item.size() > 0 && item.get(0).getX() >= minSpeed && item.get(0).getX() < maxSpeed) {
|
|
|
sum += Math.pow((point.getY() - item.get(0).getY()), 2);
|
|
|
count++;
|
|
|
pc += point.getY() - item.get(0).getY();
|
|
@@ -734,9 +935,8 @@ public class PowerCurveFittingService {
|
|
|
}
|
|
|
|
|
|
//todo-sl 添加数据筛选
|
|
|
- private boolean filterData( PointData gl, PointData fs, PointData zt, double maxvalue, String windturbineId) throws Exception {
|
|
|
- if(StringUtils.notEmp(gl))
|
|
|
- {
|
|
|
+ private boolean filterData(PointData gl, PointData fs, PointData zt, double maxvalue, String windturbineId) throws Exception {
|
|
|
+ if (StringUtils.notEmp(gl)) {
|
|
|
//判定功率是否超过最大值
|
|
|
if (gl.getPointValueInDouble() > maxvalue) {
|
|
|
return false;
|
|
@@ -782,6 +982,7 @@ public class PowerCurveFittingService {
|
|
|
for (PointData p : points) {
|
|
|
if (p.getPointValueInDouble() != 2) {
|
|
|
return false;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -806,6 +1007,18 @@ public class PowerCurveFittingService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //欠发状态大于2过滤掉
|
|
|
+ pointid = new ArrayList<>();
|
|
|
+
|
|
|
+ pointid.add(wtpointmap.get(ContantXk.LSQFZT).getNemCode());
|
|
|
+ value = edosUtil.getHistMatrix(pointid, gl.getPointTime() / 1000);
|
|
|
+ if (null != value && value.size() > 0) {
|
|
|
+ double qfzt = value.get(0).getPointValueInDouble();
|
|
|
+
|
|
|
+ if (qfzt > 2) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
|