|
@@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Propagation;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.math.RoundingMode;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -52,17 +53,6 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
ForecastPowerShortTermService forecastPowerShortTermService;
|
|
ForecastPowerShortTermService forecastPowerShortTermService;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 生成超短期预测功率,自动更新覆盖预测功率
|
|
|
|
- *
|
|
|
|
- * @param startTime 开始时间
|
|
|
|
- * @param endTime 结束时间
|
|
|
|
- */
|
|
|
|
- @Transactional(propagation = Propagation.REQUIRED)
|
|
|
|
- public void buildForecastPowerUltraShortTerm(@NotNull final Long startTime, @NotNull final Long endTime, String stationCode) {
|
|
|
|
- this.getForecastPowerUltraShortTerm(startTime, endTime, stationCode);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
* 获取超短期预测功率,当数据库中超短期预测记录不足查询所需时,进行本地化计算,用于上报专用
|
|
* 获取超短期预测功率,当数据库中超短期预测记录不足查询所需时,进行本地化计算,用于上报专用
|
|
*
|
|
*
|
|
* @param startTime 开始时间
|
|
* @param startTime 开始时间
|
|
@@ -82,7 +72,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
} catch (BusinessException e) {
|
|
} catch (BusinessException e) {
|
|
log.error(stationCode + "超短期数据生成获取开机容量出错:" + CommonUtil.printStackTraceToString(e));
|
|
log.error(stationCode + "超短期数据生成获取开机容量出错:" + CommonUtil.printStackTraceToString(e));
|
|
}
|
|
}
|
|
- Long monentTime = 0L;
|
|
|
|
|
|
+ long monentTime = 0L;
|
|
try {
|
|
try {
|
|
monentTime = DateMomentUtil.getMomentTime(new Date().getTime(), 1, 15 * 60 * 1000L);
|
|
monentTime = DateMomentUtil.getMomentTime(new Date().getTime(), 1, 15 * 60 * 1000L);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -98,7 +88,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
}
|
|
}
|
|
|
|
|
|
Long momentTime = 15 * 60 * 1000L; // 15分钟一个时刻
|
|
Long momentTime = 15 * 60 * 1000L; // 15分钟一个时刻
|
|
- Integer moments = Math.toIntExact((endTime - startTime) / momentTime + 1);
|
|
|
|
|
|
+ int moments = Math.toIntExact((endTime - startTime) / momentTime + 1);
|
|
log.info(stationCode + "所需时间moments个数:" + moments);
|
|
log.info(stationCode + "所需时间moments个数:" + moments);
|
|
log.info(stationCode + "获取所需记录数:" + forecastPowerUltraShortTermList.size());
|
|
log.info(stationCode + "获取所需记录数:" + forecastPowerUltraShortTermList.size());
|
|
if (moments > forecastPowerUltraShortTermList.size()) {
|
|
if (moments > forecastPowerUltraShortTermList.size()) {
|
|
@@ -109,22 +99,22 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
BigDecimal tempValue;
|
|
BigDecimal tempValue;
|
|
if (ElectricFieldTypeEnum.E1.equals(electricFieldInfo.getElectricFieldTypeEnum())) {
|
|
if (ElectricFieldTypeEnum.E1.equals(electricFieldInfo.getElectricFieldTypeEnum())) {
|
|
if (DateTimeUtil.checkInSunriseAndSunset(startTime, electricFieldInfo.getLongitude().doubleValue(), electricFieldInfo.getLatitude().doubleValue())) {
|
|
if (DateTimeUtil.checkInSunriseAndSunset(startTime, electricFieldInfo.getLongitude().doubleValue(), electricFieldInfo.getLatitude().doubleValue())) {
|
|
- tempValue = new BigDecimal(CommonUtil.getRandom(1, 70) / 100.0d);
|
|
|
|
|
|
+ tempValue = BigDecimal.valueOf(CommonUtil.getRandom(1, 70) / 100.0d);
|
|
} else {
|
|
} else {
|
|
// 日升日落
|
|
// 日升日落
|
|
tempValue = BigDecimal.ZERO;
|
|
tempValue = BigDecimal.ZERO;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- tempValue = new BigDecimal(CommonUtil.getRandom(1, 70) / 100.0d);
|
|
|
|
|
|
+ tempValue = BigDecimal.valueOf(CommonUtil.getRandom(1, 70) / 100.0d);
|
|
}
|
|
}
|
|
- tempValue = tempValue.multiply(electricFieldInfo.getCapacity()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ tempValue = tempValue.multiply(electricFieldInfo.getCapacity()).setScale(2, RoundingMode.HALF_UP);
|
|
ForecastPowerUltraShortTerm forecastPowerUltraShortTerm = new ForecastPowerUltraShortTerm();
|
|
ForecastPowerUltraShortTerm forecastPowerUltraShortTerm = new ForecastPowerUltraShortTerm();
|
|
forecastPowerUltraShortTerm.setGenDate(new Date(monentTime));
|
|
forecastPowerUltraShortTerm.setGenDate(new Date(monentTime));
|
|
forecastPowerUltraShortTerm.setForecastTime(tempTime);
|
|
forecastPowerUltraShortTerm.setForecastTime(tempTime);
|
|
forecastPowerUltraShortTerm.setFpValue(tempValue);
|
|
forecastPowerUltraShortTerm.setFpValue(tempValue);
|
|
forecastPowerUltraShortTerm.setPredictionModelEnum(PredictionModelEnum.E4);
|
|
forecastPowerUltraShortTerm.setPredictionModelEnum(PredictionModelEnum.E4);
|
|
- forecastPowerUltraShortTerm.setCoefficientValue(new BigDecimal(-0.99).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
|
- forecastPowerUltraShortTerm.setDifferenceValue(new BigDecimal(-0.99).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
|
+ forecastPowerUltraShortTerm.setCoefficientValue(BigDecimal.valueOf(-0.99).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
+ forecastPowerUltraShortTerm.setDifferenceValue(BigDecimal.valueOf(-0.99).setScale(2, RoundingMode.HALF_UP));
|
|
forecastPowerUltraShortTerm.setStationCode(stationCode);
|
|
forecastPowerUltraShortTerm.setStationCode(stationCode);
|
|
// 保存超短期实时预测记录
|
|
// 保存超短期实时预测记录
|
|
this.forecastPowerUltraShortTermRepository.save(forecastPowerUltraShortTerm);
|
|
this.forecastPowerUltraShortTermRepository.save(forecastPowerUltraShortTerm);
|
|
@@ -145,7 +135,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
//生成数据
|
|
//生成数据
|
|
for (ForecastPowerUltraShortTerm forecastPowerUltraShortTerm : forecastPowerUltraShortTermList) {
|
|
for (ForecastPowerUltraShortTerm forecastPowerUltraShortTerm : forecastPowerUltraShortTermList) {
|
|
forecastPowerUltraShortTermHis = new ForecastPowerUltraShortTermHis();
|
|
forecastPowerUltraShortTermHis = new ForecastPowerUltraShortTermHis();
|
|
- openCapacity = openCapacityMap.get(forecastPowerUltraShortTerm.getForecastTime());
|
|
|
|
|
|
+ openCapacity = openCapacityMap != null ? openCapacityMap.get(forecastPowerUltraShortTerm.getForecastTime()) : electricFieldInfo.getCapacity();
|
|
forecastPowerUltraShortTermHis.setForecastTime(forecastPowerUltraShortTerm.getForecastTime());
|
|
forecastPowerUltraShortTermHis.setForecastTime(forecastPowerUltraShortTerm.getForecastTime());
|
|
forecastPowerUltraShortTermHis.setSuCapacity(openCapacity);
|
|
forecastPowerUltraShortTermHis.setSuCapacity(openCapacity);
|
|
forecastPowerUltraShortTermHis.setCapacity(electricFieldInfo.getCapacity());
|
|
forecastPowerUltraShortTermHis.setCapacity(electricFieldInfo.getCapacity());
|
|
@@ -153,7 +143,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
forecastPowerUltraShortTermHis.setTheoryValue(forecastPowerUltraShortTerm.getFpValue());
|
|
forecastPowerUltraShortTermHis.setTheoryValue(forecastPowerUltraShortTerm.getFpValue());
|
|
// 预测可用功率=预测*(开机容量/装机容量)
|
|
// 预测可用功率=预测*(开机容量/装机容量)
|
|
BigDecimal fpValue = forecastPowerUltraShortTerm.getFpValue().multiply(openCapacity)
|
|
BigDecimal fpValue = forecastPowerUltraShortTerm.getFpValue().multiply(openCapacity)
|
|
- .divide(electricFieldInfo.getCapacity(), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ .divide(electricFieldInfo.getCapacity(), 2, RoundingMode.HALF_UP);
|
|
forecastPowerUltraShortTermHis.setAbleValue(fpValue);
|
|
forecastPowerUltraShortTermHis.setAbleValue(fpValue);
|
|
forecastPowerUltraShortTermHis.setPredictionModelEnum(forecastPowerUltraShortTerm.getPredictionModelEnum());
|
|
forecastPowerUltraShortTermHis.setPredictionModelEnum(forecastPowerUltraShortTerm.getPredictionModelEnum());
|
|
forecastPowerUltraShortTermHis.setDifferenceValue(forecastPowerUltraShortTerm.getDifferenceValue());
|
|
forecastPowerUltraShortTermHis.setDifferenceValue(forecastPowerUltraShortTerm.getDifferenceValue());
|
|
@@ -164,11 +154,11 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
}
|
|
}
|
|
// List<ForecastPowerUltraShortTermHis> forecastPowerUltraShortTermHiss = forecastPowerUltraShortTermHiss1.stream().filter(t -> t.getForecastHowLongAgo() <=16).collect(Collectors.toList());
|
|
// List<ForecastPowerUltraShortTermHis> forecastPowerUltraShortTermHiss = forecastPowerUltraShortTermHiss1.stream().filter(t -> t.getForecastHowLongAgo() <=16).collect(Collectors.toList());
|
|
// 获取实际功率替换超短期点位参数
|
|
// 获取实际功率替换超短期点位参数
|
|
- Integer replacePoint = 0;
|
|
|
|
|
|
+ int replacePoint;
|
|
String realpower_replace_cdq = sysParameterService.getSysParameter("realpower_replace_cdq", "0", stationCode);
|
|
String realpower_replace_cdq = sysParameterService.getSysParameter("realpower_replace_cdq", "0", stationCode);
|
|
- replacePoint = Integer.valueOf(realpower_replace_cdq);
|
|
|
|
|
|
+ replacePoint = Integer.parseInt(realpower_replace_cdq);
|
|
if (replacePoint <= forecastPowerUltraShortTermHiss.size() && replacePoint > 0) {
|
|
if (replacePoint <= forecastPowerUltraShortTermHiss.size() && replacePoint > 0) {
|
|
- Long pre5Time = 0l;
|
|
|
|
|
|
+ long pre5Time;
|
|
Date systemDate = new Date();
|
|
Date systemDate = new Date();
|
|
try {
|
|
try {
|
|
// 获取前5分钟时刻
|
|
// 获取前5分钟时刻
|
|
@@ -228,10 +218,10 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
// 根据场站类型执行相应超短期预测
|
|
// 根据场站类型执行相应超短期预测
|
|
try {
|
|
try {
|
|
String cdqUpMin = super.getSysParameter("CDQ_UP_MIN", "0", stationCode);
|
|
String cdqUpMin = super.getSysParameter("CDQ_UP_MIN", "0", stationCode);
|
|
- Long currentTime = System.currentTimeMillis() + Integer.parseInt(cdqUpMin) * 1000 * 60;
|
|
|
|
|
|
+ Long currentTime = System.currentTimeMillis() + (long) Integer.parseInt(cdqUpMin) * 1000 * 60;
|
|
String llcdq_point = sysParameterService.getSysParameter("FILE_LLCDQ_POINT", "16", stationCode);
|
|
String llcdq_point = sysParameterService.getSysParameter("FILE_LLCDQ_POINT", "16", stationCode);
|
|
- Integer forecastPoints = Integer.parseInt(llcdq_point);
|
|
|
|
- Integer forecastMinutes = forecastPoints * 15;
|
|
|
|
|
|
+ int forecastPoints = Integer.parseInt(llcdq_point);
|
|
|
|
+ int forecastMinutes = forecastPoints * 15;
|
|
|
|
|
|
// 超短期提前N分钟生成文件
|
|
// 超短期提前N分钟生成文件
|
|
Long startTime = DateMomentUtil.getMomentTime(currentTime, 1, 15 * 60 * 1000L);
|
|
Long startTime = DateMomentUtil.getMomentTime(currentTime, 1, 15 * 60 * 1000L);
|
|
@@ -252,11 +242,11 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
for (Long tempTime = startTime; tempTime <= endTime; tempTime = tempTime + 15 * 60 * 1000L) {
|
|
for (Long tempTime = startTime; tempTime <= endTime; tempTime = tempTime + 15 * 60 * 1000L) {
|
|
if (forecastPowerShortTermsMap.get(tempTime) == null) {
|
|
if (forecastPowerShortTermsMap.get(tempTime) == null) {
|
|
// 缺失时间点
|
|
// 缺失时间点
|
|
- ForecastPowerShortTerm forecastPowerShortTerms = null;
|
|
|
|
|
|
+ ForecastPowerShortTerm forecastPowerShortTerms;
|
|
if (ElectricFieldTypeEnum.E1.compareTo(electricField.getElectricFieldTypeEnum()) == 0) {
|
|
if (ElectricFieldTypeEnum.E1.compareTo(electricField.getElectricFieldTypeEnum()) == 0) {
|
|
- forecastPowerShortTerms = forecastPowerShortTermService.generateSolarPowerShortTerm(tempTime, openCapacityMap.get(tempTime), electricField);
|
|
|
|
|
|
+ forecastPowerShortTerms = forecastPowerShortTermService.generateSolarPowerShortTerm(tempTime, openCapacityMap != null ? openCapacityMap.get(tempTime) : electricField.getCapacity(), electricField);
|
|
} else {
|
|
} else {
|
|
- forecastPowerShortTerms = forecastPowerShortTermService.generateWindPowerShortTerm(tempTime, openCapacityMap.get(tempTime), stationCode);
|
|
|
|
|
|
+ forecastPowerShortTerms = forecastPowerShortTermService.generateWindPowerShortTerm(tempTime, openCapacityMap != null ? openCapacityMap.get(tempTime) : electricField.getCapacity(), stationCode);
|
|
}
|
|
}
|
|
addForecastPowerShortTermList.add(forecastPowerShortTerms);
|
|
addForecastPowerShortTermList.add(forecastPowerShortTerms);
|
|
}
|
|
}
|
|
@@ -293,7 +283,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
* @param forecastPowerShortTermList 短期预测结果集
|
|
* @param forecastPowerShortTermList 短期预测结果集
|
|
* @param capacity 装机容量
|
|
* @param capacity 装机容量
|
|
*/
|
|
*/
|
|
- private List<ForecastPowerUltraShortTerm> executeForecastForWind(final List<ForecastPowerShortTerm> forecastPowerShortTermList, final BigDecimal capacity, String stationCode) {
|
|
|
|
|
|
+ private void executeForecastForWind(final List<ForecastPowerShortTerm> forecastPowerShortTermList, final BigDecimal capacity, String stationCode) {
|
|
List<ForecastPowerUltraShortTerm> forecastPowerUltraShortTermList = new ArrayList<>();
|
|
List<ForecastPowerUltraShortTerm> forecastPowerUltraShortTermList = new ArrayList<>();
|
|
ForecastPowerUltraShortTerm forecastPowerUltraShortTerm;
|
|
ForecastPowerUltraShortTerm forecastPowerUltraShortTerm;
|
|
//获取系统参数cdqjsfs,超短期计算方式,0为默认乘系数的方式,1为根据可用功率计算的方式
|
|
//获取系统参数cdqjsfs,超短期计算方式,0为默认乘系数的方式,1为根据可用功率计算的方式
|
|
@@ -310,7 +300,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
List<PowerStationStatusData> filterList = powerStationStatusDataList.stream().filter(t -> t.getAbleValue().compareTo(new BigDecimal("-1")) == 1).collect(Collectors.toList());
|
|
List<PowerStationStatusData> filterList = powerStationStatusDataList.stream().filter(t -> t.getAbleValue().compareTo(new BigDecimal("-1")) == 1).collect(Collectors.toList());
|
|
String coe = super.getSysParameter("CDQ_COE", "1.05", stationCode);
|
|
String coe = super.getSysParameter("CDQ_COE", "1.05", stationCode);
|
|
|
|
|
|
- Long monentTime = 0L;
|
|
|
|
|
|
+ long monentTime = 0L;
|
|
try {
|
|
try {
|
|
monentTime = DateMomentUtil.getMomentTime(new Date().getTime(), 1, 15 * 60 * 1000L);
|
|
monentTime = DateMomentUtil.getMomentTime(new Date().getTime(), 1, 15 * 60 * 1000L);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -319,7 +309,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
if (filterList.size() > 0) {
|
|
if (filterList.size() > 0) {
|
|
BigDecimal sumAbleValue = filterList.stream().map(PowerStationStatusData::getAbleValue)
|
|
BigDecimal sumAbleValue = filterList.stream().map(PowerStationStatusData::getAbleValue)
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
- BigDecimal averageAbleValue = sumAbleValue.divide(new BigDecimal(filterList.size()), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ BigDecimal averageAbleValue = sumAbleValue.divide(new BigDecimal(filterList.size()), 2, RoundingMode.HALF_UP);
|
|
//可用-短期差值
|
|
//可用-短期差值
|
|
BigDecimal deviationValue = averageAbleValue.subtract(currentForecastPowerShortTerm.getFpValue());
|
|
BigDecimal deviationValue = averageAbleValue.subtract(currentForecastPowerShortTerm.getFpValue());
|
|
for (int i = 1; i < forecastPowerShortTermList.size(); i++) {
|
|
for (int i = 1; i < forecastPowerShortTermList.size(); i++) {
|
|
@@ -329,7 +319,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
//短期
|
|
//短期
|
|
stPower = forecastPowerShortTermList.get(i).getFpValue();
|
|
stPower = forecastPowerShortTermList.get(i).getFpValue();
|
|
//短期*系数
|
|
//短期*系数
|
|
- ustPowers = stPower.multiply(new BigDecimal(coe)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ ustPowers = stPower.multiply(new BigDecimal(coe)).setScale(2, RoundingMode.HALF_UP);
|
|
// 如果短期预测小于等于0,则超短期为0
|
|
// 如果短期预测小于等于0,则超短期为0
|
|
if (stPower.doubleValue() <= 0) {
|
|
if (stPower.doubleValue() <= 0) {
|
|
forecastPowerUltraShortTerm.setFpValue(BigDecimal.ZERO);
|
|
forecastPowerUltraShortTerm.setFpValue(BigDecimal.ZERO);
|
|
@@ -337,12 +327,12 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
forecastPowerUltraShortTerm.setCoefficientValue(BigDecimal.ZERO);
|
|
forecastPowerUltraShortTerm.setCoefficientValue(BigDecimal.ZERO);
|
|
forecastPowerUltraShortTerm.setPredictionModelEnum(PredictionModelEnum.E4);
|
|
forecastPowerUltraShortTerm.setPredictionModelEnum(PredictionModelEnum.E4);
|
|
} else {
|
|
} else {
|
|
- BigDecimal xzjdq = deviationValue.add(stPower).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ BigDecimal xzjdq = deviationValue.add(stPower).setScale(2, RoundingMode.HALF_UP);
|
|
String cdqjsfsZbxz = electricFieldService.getSysParameter("cdqjsfsZbxz", "0.4", stationCode);
|
|
String cdqjsfsZbxz = electricFieldService.getSysParameter("cdqjsfsZbxz", "0.4", stationCode);
|
|
log.debug("参数cdqjsfsZbxz值为:" + cdqjsfsZbxz + ",超短期计算方式,可用和短期的差值加短期占比。");
|
|
log.debug("参数cdqjsfsZbxz值为:" + cdqjsfsZbxz + ",超短期计算方式,可用和短期的差值加短期占比。");
|
|
String cdqjsfsZbdq = electricFieldService.getSysParameter("cdqjsfsZbdq", "0.6", stationCode);
|
|
String cdqjsfsZbdq = electricFieldService.getSysParameter("cdqjsfsZbdq", "0.6", stationCode);
|
|
log.debug("参数cdqjsfsZbdq值为:" + cdqjsfsZbdq + ",超短期计算方式,短期占比。");
|
|
log.debug("参数cdqjsfsZbdq值为:" + cdqjsfsZbdq + ",超短期计算方式,短期占比。");
|
|
- ustPower = xzjdq.multiply(new BigDecimal(cdqjsfsZbxz)).setScale(2, BigDecimal.ROUND_HALF_UP).add(stPower.multiply(new BigDecimal(cdqjsfsZbdq)).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
|
+ ustPower = xzjdq.multiply(new BigDecimal(cdqjsfsZbxz)).setScale(2, RoundingMode.HALF_UP).add(stPower.multiply(new BigDecimal(cdqjsfsZbdq)).setScale(2, RoundingMode.HALF_UP));
|
|
if (ustPower.doubleValue() > capacity.doubleValue()) {
|
|
if (ustPower.doubleValue() > capacity.doubleValue()) {
|
|
// 如果超短期结果超出装机容量,则超短期结果为装机容量
|
|
// 如果超短期结果超出装机容量,则超短期结果为装机容量
|
|
forecastPowerUltraShortTerm.setFpValue(capacity);
|
|
forecastPowerUltraShortTerm.setFpValue(capacity);
|
|
@@ -370,12 +360,12 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
// 短期乘以系数
|
|
// 短期乘以系数
|
|
for (int i = 1; i < forecastPowerShortTermList.size(); i++) {
|
|
for (int i = 1; i < forecastPowerShortTermList.size(); i++) {
|
|
stPower = forecastPowerShortTermList.get(i).getFpValue();
|
|
stPower = forecastPowerShortTermList.get(i).getFpValue();
|
|
- ustPower = stPower.multiply(new BigDecimal(coe)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ ustPower = stPower.multiply(new BigDecimal(coe)).setScale(2, RoundingMode.HALF_UP);
|
|
forecastPowerUltraShortTerm = new ForecastPowerUltraShortTerm();
|
|
forecastPowerUltraShortTerm = new ForecastPowerUltraShortTerm();
|
|
forecastPowerUltraShortTerm.setForecastTime(forecastPowerShortTermList.get(i).getForecastTime());
|
|
forecastPowerUltraShortTerm.setForecastTime(forecastPowerShortTermList.get(i).getForecastTime());
|
|
forecastPowerUltraShortTerm.setPredictionModelEnum(PredictionModelEnum.E9);
|
|
forecastPowerUltraShortTerm.setPredictionModelEnum(PredictionModelEnum.E9);
|
|
forecastPowerUltraShortTerm.setCoefficientValue(ustPower);
|
|
forecastPowerUltraShortTerm.setCoefficientValue(ustPower);
|
|
- forecastPowerUltraShortTerm.setDifferenceValue(new BigDecimal(-0.99).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
|
+ forecastPowerUltraShortTerm.setDifferenceValue(new BigDecimal(-0.99).setScale(2, RoundingMode.HALF_UP));
|
|
forecastPowerUltraShortTerm.setFpValue(ustPower);
|
|
forecastPowerUltraShortTerm.setFpValue(ustPower);
|
|
forecastPowerUltraShortTerm.setGenDate(new Date(monentTime));
|
|
forecastPowerUltraShortTerm.setGenDate(new Date(monentTime));
|
|
forecastPowerUltraShortTerm.setStationCode(stationCode);
|
|
forecastPowerUltraShortTerm.setStationCode(stationCode);
|
|
@@ -386,7 +376,6 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
this.forecastPowerUltraShortTermRepository.deleteByForecastTimeBetweenAndStationCode(forecastPowerShortTermList.get(1).getForecastTime(), forecastPowerShortTermList.get(forecastPowerShortTermList.size() - 1).getForecastTime(), stationCode);
|
|
this.forecastPowerUltraShortTermRepository.deleteByForecastTimeBetweenAndStationCode(forecastPowerShortTermList.get(1).getForecastTime(), forecastPowerShortTermList.get(forecastPowerShortTermList.size() - 1).getForecastTime(), stationCode);
|
|
this.forecastPowerUltraShortTermRepository.saveAll(forecastPowerUltraShortTermList);
|
|
this.forecastPowerUltraShortTermRepository.saveAll(forecastPowerUltraShortTermList);
|
|
|
|
|
|
- return forecastPowerUltraShortTermList;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void executeForecastForlight(final List<ForecastPowerShortTerm> forecastPowerShortTermList, final BigDecimal capacity, String stationCode) {
|
|
private void executeForecastForlight(final List<ForecastPowerShortTerm> forecastPowerShortTermList, final BigDecimal capacity, String stationCode) {
|
|
@@ -416,7 +405,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
startTime = startTime - (startTime % timeStep) + timeStep;
|
|
startTime = startTime - (startTime % timeStep) + timeStep;
|
|
}
|
|
}
|
|
if (list != null && list.size() > 0) {
|
|
if (list != null && list.size() > 0) {
|
|
- for (Long i = startTime; i < endTime; i = i + timeStep) {
|
|
|
|
|
|
+ for (long i = startTime; i < endTime; i = i + timeStep) {
|
|
long finalI = i;
|
|
long finalI = i;
|
|
List<ForecastPowerUltraShortTermHis> filterList = list.stream().filter(t -> t.getForecastTime() == finalI).collect(Collectors.toList());
|
|
List<ForecastPowerUltraShortTermHis> filterList = list.stream().filter(t -> t.getForecastTime() == finalI).collect(Collectors.toList());
|
|
if (filterList != null && filterList.size() > 0) {
|
|
if (filterList != null && filterList.size() > 0) {
|
|
@@ -443,7 +432,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
*/
|
|
*/
|
|
@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
|
|
@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
|
|
public Map<String, Object> findByForecastRealTimeUltraShortTerm16(Long startTime, String stationCode) {
|
|
public Map<String, Object> findByForecastRealTimeUltraShortTerm16(Long startTime, String stationCode) {
|
|
- Long endTime = startTime + 60 * 60 * 1000 * 24;
|
|
|
|
|
|
+ long endTime = startTime + 60 * 60 * 1000 * 24;
|
|
// List<Map<String,Object>> valueList16 = new ArrayList<>();
|
|
// List<Map<String,Object>> valueList16 = new ArrayList<>();
|
|
//取出16点数据存入集合中
|
|
//取出16点数据存入集合中
|
|
Map<String, Object> realPowerMap = new HashMap<>();
|
|
Map<String, Object> realPowerMap = new HashMap<>();
|
|
@@ -453,13 +442,11 @@ public class ForecastPowerUltraShortTermService extends BaseService {
|
|
int finalP = p;
|
|
int finalP = p;
|
|
List<ForecastPowerUltraShortTermHis> filterList = forecastPowerUltraShortTermHisList.stream().filter(t -> t.getForecastHowLongAgo() == finalP).collect(Collectors.toList());
|
|
List<ForecastPowerUltraShortTermHis> filterList = forecastPowerUltraShortTermHisList.stream().filter(t -> t.getForecastHowLongAgo() == finalP).collect(Collectors.toList());
|
|
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
long timeStep = 900000L;
|
|
long timeStep = 900000L;
|
|
if (startTime % timeStep != 0) {
|
|
if (startTime % timeStep != 0) {
|
|
startTime = startTime - (startTime % timeStep);
|
|
startTime = startTime - (startTime % timeStep);
|
|
}
|
|
}
|
|
List<Float> ableDatas = new ArrayList<>();
|
|
List<Float> ableDatas = new ArrayList<>();
|
|
- List<String> times = new ArrayList<>();
|
|
|
|
|
|
|
|
for (long i = startTime; i < endTime; i = i + 900000L) {
|
|
for (long i = startTime; i < endTime; i = i + 900000L) {
|
|
long finalI = i;
|
|
long finalI = i;
|