|
@@ -2,7 +2,9 @@ package com.gyee.power.fitting.service.custom.fiveloss;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.gyee.power.fitting.common.constants.Constants;
|
|
|
+import com.gyee.power.fitting.common.exception.CustomException;
|
|
|
import com.gyee.power.fitting.common.feign.RemoteServiceBuilder;
|
|
|
+import com.gyee.power.fitting.common.result.ResultCode;
|
|
|
import com.gyee.power.fitting.common.spring.InitialRunner;
|
|
|
import com.gyee.power.fitting.common.util.CollectUtil;
|
|
|
import com.gyee.power.fitting.common.util.DateUtil;
|
|
@@ -16,7 +18,6 @@ import com.gyee.power.fitting.model.custom.TableTitle;
|
|
|
import com.gyee.power.fitting.model.custom.TsDoubleData;
|
|
|
import com.gyee.power.fitting.service.PowerfittinganalysisService;
|
|
|
import com.gyee.power.fitting.service.PowerlossinfoService;
|
|
|
-import com.gyee.power.fitting.service.Windturbinetestingpointai2Service;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -26,7 +27,6 @@ import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -42,7 +42,7 @@ public class FiveLossService {
|
|
|
private RemoteServiceBuilder remoteService;
|
|
|
|
|
|
/**
|
|
|
- * 五项损失
|
|
|
+ * 五项损失查询
|
|
|
*
|
|
|
* @param station 场站
|
|
|
* @param project 期次
|
|
@@ -118,18 +118,22 @@ public class FiveLossService {
|
|
|
public void fiveLossCal() {
|
|
|
log.info("======风机绩效榜计算开始.............");
|
|
|
Map<String, Windturbine> wtmap = InitialRunner.wtMap;
|
|
|
- Map<String, List<Modelpowerdetails>> modelmap = InitialRunner.modelPowerDetailMap;
|
|
|
+ Map<String, List<Powermodel>> modelmap = InitialRunner.zsllglMap;
|
|
|
|
|
|
List<Powerfittinganalysis> analyses = analysisService.selectListByIsCal(Constants.DATA_PREPARE, 0);
|
|
|
- if (analyses.size() == 0)
|
|
|
+ if (analyses.size() == 0){
|
|
|
+ log.info("======风机榜效帮计算结束,Powerfittinganalysis数据为空.............");
|
|
|
return;
|
|
|
+ }
|
|
|
|
|
|
for (Powerfittinganalysis p : analyses) {
|
|
|
List<Powerlossinfo> result = new ArrayList<>();
|
|
|
Windturbine wt = wtmap.get(p.getWindturbine());
|
|
|
List<String> content = FileUtil.readFile(p.getPath(), true);
|
|
|
- if (content.size() == 0)
|
|
|
+ if (content.size() == 0){
|
|
|
+ log.info("======风机榜效帮计算结束,文件内容为空.............");
|
|
|
continue;
|
|
|
+ }
|
|
|
|
|
|
log.info("======风机绩效榜计算:" + p.getWindturbine());
|
|
|
content.remove(0); //去掉标题栏
|
|
@@ -145,17 +149,17 @@ public class FiveLossService {
|
|
|
double xnssdl = 0;//性能损失电量
|
|
|
|
|
|
List<PowerPointData> pdl = ls.stream().map(mp -> new PowerPointData(mp.split(","), false)).collect(Collectors.toList());
|
|
|
- double zcfd = generalLoss(pdl, modelmap.get(wt.getModelid()), p.getInterp(), 2); //正常发电
|
|
|
- xdssdl = generalLoss(pdl, modelmap.get(wt.getModelid()), p.getInterp(), 5); //限电损失电量
|
|
|
- double qxjcl = generalLoss(pdl, modelmap.get(wt.getModelid()), p.getInterp(), 3); //缺陷降出力损失电量
|
|
|
- double xdjcl = generalLoss(pdl, modelmap.get(wt.getModelid()), p.getInterp(), 4); //限电降出力损失电量
|
|
|
- double cnsltj = generalLoss(pdl, modelmap.get(wt.getModelid()), p.getInterp(), 7); //场内受累停机损失电量
|
|
|
- double cnsljx = generalLoss(pdl, modelmap.get(wt.getModelid()), p.getInterp(), 9); //场内受累检修损失电量
|
|
|
- double dwsl = generalLoss(pdl, modelmap.get(wt.getModelid()), p.getInterp(), 10); //电网受累损失电量
|
|
|
- double hjsl = generalLoss(pdl, modelmap.get(wt.getModelid()), p.getInterp(), 11); //环境受累损失电量
|
|
|
-
|
|
|
- gzssdl = generalLoss(pdl, modelmap.get(wt.getModelid()), p.getInterp(), 6);
|
|
|
- jhjxssdl = generalLoss(pdl, modelmap.get(wt.getModelid()), p.getInterp(), 8);
|
|
|
+ double zcfd = generalLoss(pdl, modelmap.get(p.getWindturbine()), p.getInterp(), 2); //正常发电
|
|
|
+ xdssdl = generalLoss(pdl, modelmap.get(p.getWindturbine()), p.getInterp(), 5); //限电损失电量
|
|
|
+ double qxjcl = generalLoss(pdl, modelmap.get(p.getWindturbine()), p.getInterp(), 3); //缺陷降出力损失电量
|
|
|
+ double xdjcl = generalLoss(pdl, modelmap.get(p.getWindturbine()), p.getInterp(), 4); //限电降出力损失电量
|
|
|
+ double cnsltj = generalLoss(pdl, modelmap.get(p.getWindturbine()), p.getInterp(), 7); //场内受累停机损失电量
|
|
|
+ double cnsljx = generalLoss(pdl, modelmap.get(p.getWindturbine()), p.getInterp(), 9); //场内受累检修损失电量
|
|
|
+ double dwsl = generalLoss(pdl, modelmap.get(p.getWindturbine()), p.getInterp(), 10); //电网受累损失电量
|
|
|
+ double hjsl = generalLoss(pdl, modelmap.get(p.getWindturbine()), p.getInterp(), 11); //环境受累损失电量
|
|
|
+
|
|
|
+ gzssdl = generalLoss(pdl, modelmap.get(p.getWindturbine()), p.getInterp(), 6);
|
|
|
+ jhjxssdl = generalLoss(pdl, modelmap.get(p.getWindturbine()), p.getInterp(), 8);
|
|
|
fjhjxssdl = gzssdl;
|
|
|
xdssdl = xdssdl + xdjcl;
|
|
|
slssdl = cnsltj + dwsl + hjsl + cnsljx + cnsljx;
|
|
@@ -201,15 +205,15 @@ public class FiveLossService {
|
|
|
* @param status 风机当前状态
|
|
|
* @return
|
|
|
*/
|
|
|
- private double generalLoss(List<PowerPointData> ztmxData, List<Modelpowerdetails> zsglData, int interval, double status) {
|
|
|
+ private double generalLoss(List<PowerPointData> ztmxData, List<Powermodel> zsglData, int interval, double status) {
|
|
|
double ssdl = 0.0;
|
|
|
List<PowerPointData> pointData = ztmxData.stream().filter(zt -> zt.getMxzt() == status).collect(Collectors.toList());
|
|
|
- List<Modelpowerdetails> theoryData = zsglData.stream().filter(f -> f.getTheorypower() > 0).collect(Collectors.toList());
|
|
|
- if (status == 2.0 || status == 3.0 || status == 4.0 || status == 9.0 || status == 10.0 || status == 11.0) {
|
|
|
+ List<Powermodel> theoryData = zsglData.stream().filter(f -> f.getPower() > 0.0).collect(Collectors.toList());
|
|
|
+ if (status == 0.0 || status == 2.0 || status == 3.0 || status == 4.0 || status == 9.0 || status == 11.0) {
|
|
|
for (PowerPointData obj : pointData) {
|
|
|
for (int i = 0; i < theoryData.size(); i++) {
|
|
|
if (String.format("%.2f", obj.getSpeed()).equals(String.format("%.2f", theoryData.get(i).getSpeed()))) {
|
|
|
- double zsgl = theoryData.get(i).getTheorypower();
|
|
|
+ double zsgl = theoryData.get(i).getPower();
|
|
|
double power = obj.getPower();
|
|
|
double temp = (zsgl - power) > 0 ? zsgl - power : 0;
|
|
|
ssdl = ssdl + (temp / 60) * (interval / 60);
|
|
@@ -221,7 +225,7 @@ public class FiveLossService {
|
|
|
for (PowerPointData obj : pointData) {
|
|
|
for (int i = 0; i < theoryData.size(); i++) {
|
|
|
if (String.format("%.2f", obj.getSpeed()).equals(String.format("%.2f", theoryData.get(i).getSpeed()))) {
|
|
|
- double zsgl = theoryData.get(i).getTheorypower();
|
|
|
+ double zsgl = theoryData.get(i).getPower();
|
|
|
ssdl = ssdl + (zsgl / 60) * (interval / 60);
|
|
|
break;
|
|
|
}
|
|
@@ -342,4 +346,87 @@ public class FiveLossService {
|
|
|
|
|
|
return ssdl > 0 ? ssdl : 0;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 使用文件计算五损数据
|
|
|
+ * @param ids 准备的数据ID
|
|
|
+ */
|
|
|
+ public Map<String, Object> fiveLossCal(String ids) {
|
|
|
+ log.info("======风机绩效榜计算开始.............");
|
|
|
+ Map<String, Object> promise = new HashMap<>();
|
|
|
+ List<FjjxbVo> result = new ArrayList<>();
|
|
|
+ Map<String, List<Powermodel>> zsglmap = InitialRunner.zsllglMap;
|
|
|
+
|
|
|
+ List<Powerfittinganalysis> analyses = analysisService.selectListByIds(ids);
|
|
|
+ if (analyses.size() == 0 || zsglmap.size() == 0){
|
|
|
+ log.info("======风机榜效帮计算结束,自算理论功率数据为空.............");
|
|
|
+ throw new CustomException(ResultCode.ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (Powerfittinganalysis p : analyses) {
|
|
|
+ List<String> content = FileUtil.readFile(p.getPath(), true);
|
|
|
+ if (content.size() == 0){
|
|
|
+ log.info("======风机榜效帮计算结束,文件内容为空.............");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ log.info("======风机绩效榜计算:" + p.getWindturbine());
|
|
|
+ double llfdl = 0.0; //理论发电量
|
|
|
+ double rfdl = 0.0; //日发电量
|
|
|
+ double jhjxssdl = 0.0;//计划检修损失电量
|
|
|
+ double fjhjxssdl =0.0;//非计划检修电量
|
|
|
+ double xdssdl = 0.0;//限电损失电量
|
|
|
+ double slssdl = 0.0;//受累损失电量
|
|
|
+ double xnssdl = 0.0;//性能损失电量
|
|
|
+ double speed = 0.0;//风速
|
|
|
+ content.remove(0); //去掉标题栏
|
|
|
+ int count = 86400 / p.getInterp(); //一天86400s 一天的条数
|
|
|
+ List<List<String>> coll = CollectUtil.groupListByQty(content, count);
|
|
|
+ for (List<String> ls : coll) {
|
|
|
+ List<PowerPointData> pdl = ls.stream().map(mp -> new PowerPointData(mp.split(","), false)).collect(Collectors.toList());
|
|
|
+ double lldl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), -1); //理论发电量
|
|
|
+ double dj = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 0); //待机
|
|
|
+ double sdtj = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 1); //手动停机
|
|
|
+ double zcfd = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 2); //正常发电
|
|
|
+ double xdss = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 5); //限电损失电量
|
|
|
+ double qxjcl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 3); //缺陷降出力损失电量
|
|
|
+ double xdjcl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 4); //限电降出力损失电量
|
|
|
+ double cnsltj = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 7); //场内受累停机损失电量
|
|
|
+ double cnsljx = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 9); //场内受累检修损失电量
|
|
|
+ double dwsl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 10); //电网受累损失电量
|
|
|
+ double hjsl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 11); //环境受累损失电量
|
|
|
+ double gzss = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 6); //故障损失电量
|
|
|
+ double tjjx = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 8); //停机检修
|
|
|
+
|
|
|
+ llfdl += lldl;
|
|
|
+ jhjxssdl += (tjjx + cnsljx);
|
|
|
+ fjhjxssdl += (gzss + cnsltj);
|
|
|
+ xdssdl += (xdjcl + xdss);
|
|
|
+ slssdl += (dwsl + hjsl);
|
|
|
+ xnssdl += (dj + sdtj + zcfd + qxjcl);
|
|
|
+ rfdl += pdl.get(pdl.size() - 1).getDl();
|
|
|
+ speed += pdl.stream().mapToDouble(PowerPointData::getSpeed).sum();
|
|
|
+ }
|
|
|
+ FjjxbVo vo = new FjjxbVo();
|
|
|
+ vo.setId(p.getWindturbine());
|
|
|
+ vo.setName(p.getWindturbine());
|
|
|
+ vo.setLlfdl(llfdl);
|
|
|
+ vo.setSjfdl(rfdl);
|
|
|
+ vo.setJhjx(jhjxssdl);
|
|
|
+ vo.setFjhjx(fjhjxssdl);
|
|
|
+ vo.setXd(xdssdl);
|
|
|
+ vo.setXn(xnssdl);
|
|
|
+ vo.setSl(slssdl);
|
|
|
+ vo.setSpeed(new BigDecimal(speed/content.size()).setScale(2, RoundingMode.CEILING).doubleValue());
|
|
|
+ vo.setFnlly(llfdl > 0 ? new BigDecimal(rfdl / llfdl).setScale(2, RoundingMode.CEILING).doubleValue() : 0);
|
|
|
+ result.add(vo);
|
|
|
+ }
|
|
|
+ log.info("======风机榜效帮计算结束.............");
|
|
|
+ /** 添加标题 **/
|
|
|
+ List<FixedVo> fxList = AnnotationTool.getFixedVoList(FjjxbVo.class);
|
|
|
+ List<TableTitle> lt = fxList.stream().map(d -> new TableTitle(d.getName(), d.getDes())).collect(Collectors.toList());
|
|
|
+ promise.put("title", lt);
|
|
|
+ promise.put("data", result);
|
|
|
+
|
|
|
+ return promise;
|
|
|
+ }
|
|
|
}
|