|
@@ -62,94 +62,10 @@ public class CalculationUtil {
|
|
|
* @param fieldName 属性名(层高)
|
|
|
* @return
|
|
|
*/
|
|
|
- public static List<BigDecimal> getWsForHeight(List<Map<String, Object>> filterList, String fieldName) {
|
|
|
-
|
|
|
- List<BigDecimal> wsList = new ArrayList<>();
|
|
|
- for (Map<String, Object> map : filterList) {
|
|
|
- String abnormal_type = "";
|
|
|
- //过滤异常值
|
|
|
- if (map.get("abnormal_type") != null) {
|
|
|
- abnormal_type = map.get("abnormal_type").toString();
|
|
|
- }
|
|
|
- if (map.get("ws_ave" + fieldName) != null && !map.get("ws_ave" + fieldName).equals("") && (!abnormal_type.contains("wsAve" + fieldName) || !abnormal_type.contains("ws_ave" + fieldName))) {
|
|
|
- if (Double.parseDouble(map.get("ws_ave" + fieldName).toString()) < 50) {
|
|
|
- wsList.add(getBigDecimal(map.get("ws_ave" + fieldName)));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return wsList;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据层高获取空气密度
|
|
|
- *
|
|
|
- * @param filterList 过滤出的风数据
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static List<BigDecimal> getAir(List<Map<String, Object>> filterList) {
|
|
|
- List<BigDecimal> wsList = new ArrayList<>();
|
|
|
- for (Map<String, Object> map : filterList) {
|
|
|
- String abnormal_type = "";
|
|
|
- //过滤异常值
|
|
|
- if (map.get("abnormal_type") != null) {
|
|
|
- abnormal_type = map.get("abnormal_type").toString();
|
|
|
- }
|
|
|
- if (map.get("air_density") != null && !map.get("air_density").equals("") && (!abnormal_type.contains("air_density"))) {
|
|
|
- if (Double.parseDouble(map.get("air_density").toString()) < 50) {
|
|
|
- wsList.add(getBigDecimal(map.get("air_density")));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return wsList;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据层高获取最大风速数据
|
|
|
- *
|
|
|
- * @param filterList 过滤出的风数据
|
|
|
- * @param fieldName 属性名(层高)
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static List<BigDecimal> getWsMaxForHeight(List<Map<String, Object>> filterList, String fieldName) {
|
|
|
- List<BigDecimal> wsMaxList = new ArrayList<>();
|
|
|
- for (Map<String, Object> map : filterList) {
|
|
|
- String abnormal_type = "";
|
|
|
- //过滤异常值
|
|
|
- if (map.get("abnormal_type") != null) {
|
|
|
- abnormal_type = map.get("abnormal_type").toString();
|
|
|
- }
|
|
|
- if (map.get("ws_max" + fieldName) != null && (!abnormal_type.contains("wsMax" + fieldName) || !abnormal_type.contains("ws_max" + fieldName))) {
|
|
|
- wsMaxList.add(getBigDecimal((map.get("ws_max" + fieldName))));
|
|
|
- }
|
|
|
- }
|
|
|
- return wsMaxList;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据层高获取标准差数据
|
|
|
- *
|
|
|
- * @param filterList 过滤出的风数据
|
|
|
- * @param fieldName 属性名(层高)
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static List<BigDecimal> getWsStaForHeight(List<Map<String, Object>> filterList, String fieldName) {
|
|
|
- List<BigDecimal> wsStaList = new ArrayList<>();
|
|
|
- for (Map<String, Object> map : filterList) {
|
|
|
- String abnormal_type = "";
|
|
|
- //过滤异常值
|
|
|
- if (map.get("abnormal_type") != null) {
|
|
|
- abnormal_type = map.get("abnormal_type").toString();
|
|
|
- }
|
|
|
- if (map.get("ws_sta" + fieldName) != null && (!abnormal_type.contains("wsSta" + fieldName) || !abnormal_type.contains("ws_sta" + fieldName))) {
|
|
|
- if (Double.parseDouble(map.get("ws_sta" + fieldName).toString()) < 50) {
|
|
|
- wsStaList.add(getBigDecimal((map.get("ws_sta" + fieldName))));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return wsStaList;
|
|
|
+ public static List<BigDecimal> getWsForHeight(List<ProphaseAnemometryData> filterList, String fieldName) {
|
|
|
+ return filterList.stream().filter(f -> f.getLayerHeight().equals(fieldName)).map(p -> {
|
|
|
+ return new BigDecimal(p.getWsAve());
|
|
|
+ }).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -160,7 +76,7 @@ public class CalculationUtil {
|
|
|
* @return
|
|
|
*/
|
|
|
public static BigDecimal getAvgWind(List<BigDecimal> bigDecimalList) {
|
|
|
- return new BigDecimal(bigDecimalList.stream().collect(Collectors.averagingDouble(BigDecimal::doubleValue))).setScale(2,RoundingMode.HALF_UP);
|
|
|
+ return new BigDecimal(bigDecimalList.stream().collect(Collectors.averagingDouble(BigDecimal::doubleValue))).setScale(2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -174,22 +90,14 @@ public class CalculationUtil {
|
|
|
BigDecimal density = new BigDecimal(-99);
|
|
|
try {
|
|
|
if (anemometryData.size() == weatherData.size() && anemometryData.size() != 0) {
|
|
|
- BigDecimal count = new BigDecimal(0);
|
|
|
- for (int i = 0; i < anemometryData.size(); i++) {
|
|
|
- if (weatherData.get(i).getAirDensity() != null && anemometryData.get(i).getWsAve() != null) {
|
|
|
- if (weatherData.get(i).getTs().getTime() == anemometryData.get(i).getTs().getTime()) {
|
|
|
- //计算风功率密度 空气密度*第i点的风速值的立方 求和/2 各个层高都有
|
|
|
- count = count.add(getWpdCalculate(getBigDecimal(weatherData.get(i).getAirDensity()), getBigDecimal(anemometryData.get(i).getWsAve())));
|
|
|
- } else {
|
|
|
- int finalI = i;
|
|
|
- List<ProphaseWeatherData> collect = weatherData.stream().filter(w -> w.getTs().getTime() == anemometryData.get(finalI).getTs().getTime()).collect(Collectors.toList());
|
|
|
- if (collect.size() > 0) {
|
|
|
- count = count.add(getWpdCalculate(getBigDecimal(collect.get(0).getAirDensity()), getBigDecimal(anemometryData.get(i).getWsAve())));
|
|
|
- }
|
|
|
- }
|
|
|
+ BigDecimal wpdSum = new BigDecimal(0);
|
|
|
+ for (ProphaseAnemometryData anemometryDatum : anemometryData) {
|
|
|
+ List<ProphaseWeatherData> collect = weatherData.stream().filter(w -> w.getTs().getTime() == anemometryDatum.getTs().getTime()).collect(Collectors.toList());
|
|
|
+ if (collect.size() > 0) {
|
|
|
+ wpdSum = wpdSum.add(getWpdCalculate(getBigDecimal(collect.get(0).getAirDensity()), getBigDecimal(anemometryDatum.getWsAve())));
|
|
|
}
|
|
|
}
|
|
|
- density = count.divide((new BigDecimal(weatherData.size())), 2, RoundingMode.HALF_UP);
|
|
|
+ density = wpdSum.divide(BigDecimal.valueOf(weatherData.size()), 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("计算风风能密度时发生错误");
|
|
@@ -429,28 +337,34 @@ public class CalculationUtil {
|
|
|
return value;
|
|
|
}
|
|
|
|
|
|
- //计算十分钟综合风切变
|
|
|
+ //计算综合风切变
|
|
|
public static BigDecimal getWindShear(List<ProphaseAnemometryData> prophaseAnemometryData, String[] heights) {
|
|
|
BigDecimal sumWShear = BigDecimal.ZERO;
|
|
|
- if(prophaseAnemometryData.size() > 0){
|
|
|
- String maxHeight = heights[0];
|
|
|
- List<ProphaseAnemometryData> heightCollect = prophaseAnemometryData.stream().filter(p -> p.getLayerHeight().equals(maxHeight)).collect(Collectors.toList());
|
|
|
- BigDecimal wsAveForMax = BigDecimal.valueOf(heightCollect.get(0).getWsAve());
|
|
|
- BigDecimal total = BigDecimal.ZERO;
|
|
|
- for (String minHeight : heights) {
|
|
|
- if (!getNumberFromString(minHeight).equals(getNumberFromString(maxHeight))) {
|
|
|
- List<ProphaseAnemometryData> sCollect = prophaseAnemometryData.stream().filter(p -> p.getLayerHeight().equals(minHeight)).collect(Collectors.toList());
|
|
|
- BigDecimal wsAveMin = BigDecimal.valueOf(sCollect.get(0).getWsAve());
|
|
|
- double z = new BigDecimal(getNumberFromString(maxHeight)).divide(new BigDecimal(getNumberFromString(minHeight)), 4, RoundingMode.HALF_UP).doubleValue();
|
|
|
- double z1 = Math.log10(z);
|
|
|
- BigDecimal shear = Convert.toBigDecimal(Math.log10(Convert.toDouble(wsAveForMax.divide(wsAveMin, 8, RoundingMode.HALF_UP))))
|
|
|
- .divide(BigDecimal.valueOf(z1), 8, RoundingMode.HALF_UP);
|
|
|
- sumWShear = sumWShear.add(shear);
|
|
|
- total = total.add(BigDecimal.ONE);
|
|
|
+ BigDecimal total = BigDecimal.ZERO;
|
|
|
+ if (prophaseAnemometryData.size() > 0) {
|
|
|
+ //循环风速数据集合
|
|
|
+ for (ProphaseAnemometryData prophaseAnemometryDatum : prophaseAnemometryData) {
|
|
|
+ //筛选同一时间的数据集合
|
|
|
+ List<ProphaseAnemometryData> collect = prophaseAnemometryData.stream().filter(p -> p.getTs().getTime() == prophaseAnemometryDatum.getTs().getTime()).collect(Collectors.toList());
|
|
|
+ String maxHeight = heights[0];
|
|
|
+ List<ProphaseAnemometryData> heightCollect = collect.stream().filter(p -> p.getLayerHeight().equals(maxHeight)).collect(Collectors.toList());
|
|
|
+ BigDecimal wsAveForMax = BigDecimal.valueOf(heightCollect.get(0).getWsAve());
|
|
|
+ //循环层高 计算每个低于最高层高的 风切变数据
|
|
|
+ for (String minHeight : heights) {
|
|
|
+ if (!getNumberFromString(minHeight).equals(getNumberFromString(maxHeight))) {
|
|
|
+ List<ProphaseAnemometryData> sCollect = collect.stream().filter(p -> p.getLayerHeight().equals(minHeight)).collect(Collectors.toList());
|
|
|
+ BigDecimal wsAveMin = BigDecimal.valueOf(sCollect.get(0).getWsAve());
|
|
|
+ double z = new BigDecimal(getNumberFromString(maxHeight)).divide(new BigDecimal(getNumberFromString(minHeight)), 4, RoundingMode.HALF_UP).doubleValue();
|
|
|
+ double z1 = Math.log10(z);
|
|
|
+ BigDecimal shear = Convert.toBigDecimal(Math.log10(Convert.toDouble(wsAveForMax.divide(wsAveMin, 8, RoundingMode.HALF_UP))))
|
|
|
+ .divide(BigDecimal.valueOf(z1), 8, RoundingMode.HALF_UP);
|
|
|
+ sumWShear = sumWShear.add(shear);
|
|
|
+ total = total.add(BigDecimal.ONE);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- if(total.compareTo(BigDecimal.ZERO) > 0){
|
|
|
- sumWShear = sumWShear.divide(total,2,RoundingMode.HALF_UP);
|
|
|
+ if (total.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ sumWShear = sumWShear.divide(total, 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
}
|
|
|
return sumWShear;
|