|
@@ -1,17 +1,17 @@
|
|
|
package com.gyee.gaia.cause.service;
|
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
-import com.gyee.gaia.cause.adapter.AdapterApi;
|
|
|
-import com.gyee.gaia.cause.adapter.ShardingApi;
|
|
|
+import com.gyee.gaia.cause.adapter.IAdapterApi;
|
|
|
+import com.gyee.gaia.cause.adapter.IShardingApi;
|
|
|
import com.gyee.gaia.cause.config.AppConfig;
|
|
|
-import com.gyee.gaia.cause.entity.PointData;
|
|
|
import com.gyee.gaia.cause.entity.StateCause;
|
|
|
+import com.gyee.gaia.cause.init.CacheContext;
|
|
|
import com.gyee.gaia.common.data.alarm.FaultInfo;
|
|
|
+import com.gyee.gaia.common.data.point.PointData;
|
|
|
import com.gyee.gaia.common.data.point.TestingPoint;
|
|
|
import com.gyee.gaia.common.data.power.ModelPower;
|
|
|
import com.gyee.gaia.common.data.windturbine.Booststation;
|
|
|
import com.gyee.gaia.common.data.windturbine.Equipment;
|
|
|
-import com.gyee.gaia.init.CacheContext;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -24,9 +24,9 @@ import java.util.stream.Collectors;
|
|
|
public class CalculateService {
|
|
|
|
|
|
@Resource
|
|
|
- private AdapterApi adapterApi;
|
|
|
+ private IAdapterApi adapterApi;
|
|
|
@Resource
|
|
|
- private ShardingApi shardingApi;
|
|
|
+ private IShardingApi shardingApi;
|
|
|
@Resource
|
|
|
private AppConfig appConfig;
|
|
|
@Resource
|
|
@@ -35,14 +35,14 @@ public class CalculateService {
|
|
|
/**
|
|
|
* 设备id,状态点列表
|
|
|
*/
|
|
|
- private final Map<String, List<PointData>> stateDatas=new HashMap<>();
|
|
|
+ private final Map<String, List<PointData>> stateDatas = new HashMap<>();
|
|
|
private Map<Double, String> stateMap;
|
|
|
private Map<String, List<FaultInfo>> fjGzMap;
|
|
|
private Map<String, List<FaultInfo>> syzGzMap;
|
|
|
|
|
|
- public void refresh(long starttime, long endtime){
|
|
|
+ public void refresh(long starttime, long endtime) {
|
|
|
log.info("刷新测点值!");
|
|
|
- CacheContext.pointMapMap.get("state8").forEach((k,v)->{
|
|
|
+ CacheContext.pointMapMap.get("state8").forEach((k, v) -> {
|
|
|
List<PointData> rawByKey = adapterApi.getRawByKey(v.getCode(), starttime, endtime);
|
|
|
stateDatas.put(k, rawByKey);
|
|
|
});
|
|
@@ -69,8 +69,8 @@ public class CalculateService {
|
|
|
//风机的8种原始状态:0-停机、 1-上电、2-待机、3-启动、4-并网、5-故障、6-维护、 7-离线
|
|
|
public void calculate() {
|
|
|
List<StateCause> stateCauseList = new ArrayList<>();
|
|
|
- stateDatas.forEach((thingId,value)->{
|
|
|
- if(value.isEmpty()) return;
|
|
|
+ stateDatas.forEach((thingId, value) -> {
|
|
|
+ if (value.isEmpty()) return;
|
|
|
//事前状态
|
|
|
double advanceState = value.get(0).getDoubleValue();
|
|
|
//事前时间
|
|
@@ -82,57 +82,58 @@ public class CalculateService {
|
|
|
ts = pointData.getTs();
|
|
|
doubleValue = pointData.getDoubleValue();
|
|
|
|
|
|
- if(doubleValue ==1||doubleValue==3) continue;
|
|
|
- if(doubleValue ==advanceState) continue;
|
|
|
+ if (doubleValue == 1 || doubleValue == 3) continue;
|
|
|
+ if (doubleValue == advanceState) continue;
|
|
|
|
|
|
//判断事前状态
|
|
|
- if(advanceState==4){
|
|
|
+ if (advanceState == 4) {
|
|
|
//计算限电
|
|
|
LinkedHashMap<Long, Long> map = calcElectricityRation(thingId, advanceTime, ts);
|
|
|
StateCause cause;
|
|
|
for (Map.Entry<Long, Long> entry : map.entrySet()) {
|
|
|
- if(entry.getKey().equals(doubleValue)){
|
|
|
- cause = new StateCause(thingId2StationId(thingId), thingId, stateMap.get(8.0),new Date(entry.getKey()),
|
|
|
+ if (entry.getKey().equals(doubleValue)) {
|
|
|
+ cause = new StateCause(thingId2StationId(thingId), thingId, stateMap.get(8.0), new Date(entry.getKey()),
|
|
|
new Date(entry.getValue()), stateMap.get(4.0), stateMap.get(doubleValue), entry.getValue() - entry.getKey());
|
|
|
- }else {
|
|
|
- cause = new StateCause(thingId2StationId(thingId), thingId, stateMap.get(8.0),new Date(entry.getKey()),
|
|
|
+ } else {
|
|
|
+ cause = new StateCause(thingId2StationId(thingId), thingId, stateMap.get(8.0), new Date(entry.getKey()),
|
|
|
new Date(entry.getValue()), stateMap.get(4.0), stateMap.get(4.0), entry.getValue() - entry.getKey());
|
|
|
}
|
|
|
stateCauseList.add(cause);
|
|
|
}
|
|
|
- }else if(advanceState==2){
|
|
|
- if(judgmentStop(thingId,advanceTime,ts)){
|
|
|
- StateCause cause = new StateCause(thingId2StationId(thingId),thingId, stateMap.get(8.0),
|
|
|
- new Date(advanceTime),new Date(ts), stateMap.get(2.0),stateMap.get(doubleValue),ts -advanceTime);
|
|
|
+ } else if (advanceState == 2) {
|
|
|
+ //计算限停
|
|
|
+ if (judgmentStop(thingId, advanceTime, ts)) {
|
|
|
+ StateCause cause = new StateCause(thingId2StationId(thingId), thingId, stateMap.get(8.0),
|
|
|
+ new Date(advanceTime), new Date(ts), stateMap.get(2.0), stateMap.get(doubleValue), ts - advanceTime);
|
|
|
stateCauseList.add(cause);
|
|
|
- }else {
|
|
|
- StateCause cause = new StateCause(thingId2StationId(thingId),thingId, stateMap.get(2.0),
|
|
|
- new Date(advanceTime),new Date(ts), stateMap.get(2.0),stateMap.get(doubleValue),ts -advanceTime);
|
|
|
+ } else {
|
|
|
+ StateCause cause = new StateCause(thingId2StationId(thingId), thingId, stateMap.get(2.0),
|
|
|
+ new Date(advanceTime), new Date(ts), stateMap.get(2.0), stateMap.get(doubleValue), ts - advanceTime);
|
|
|
stateCauseList.add(cause);
|
|
|
}
|
|
|
- }else if(advanceState==6){
|
|
|
- if(hasFaultEvent(thingId,advanceTime,ts)){
|
|
|
+ } else if (advanceState == 6) {
|
|
|
+ if (hasFaultEvent(thingId, advanceTime, ts)) {
|
|
|
//故障
|
|
|
- StateCause cause = new StateCause(thingId2StationId(thingId),thingId, stateMap.get(5.0),
|
|
|
- new Date(advanceTime),new Date(ts), stateMap.get(6.0),stateMap.get(doubleValue),ts -advanceTime);
|
|
|
+ StateCause cause = new StateCause(thingId2StationId(thingId), thingId, stateMap.get(5.0),
|
|
|
+ new Date(advanceTime), new Date(ts), stateMap.get(6.0), stateMap.get(doubleValue), ts - advanceTime);
|
|
|
stateCauseList.add(cause);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//计划检修
|
|
|
- StateCause cause = new StateCause(thingId2StationId(thingId),thingId, stateMap.get(9.0),
|
|
|
- new Date(advanceTime),new Date(ts), stateMap.get(6.0),stateMap.get(doubleValue),ts -advanceTime);
|
|
|
+ StateCause cause = new StateCause(thingId2StationId(thingId), thingId, stateMap.get(9.0),
|
|
|
+ new Date(advanceTime), new Date(ts), stateMap.get(6.0), stateMap.get(doubleValue), ts - advanceTime);
|
|
|
stateCauseList.add(cause);
|
|
|
}
|
|
|
- }else if(advanceState==5){
|
|
|
- if(ts-advanceTime<appConfig.getLongTime().get("fault-min")) continue;
|
|
|
+ } else if (advanceState == 5) {
|
|
|
+ if (ts - advanceTime < appConfig.getLongTime().get("fault-min")) continue;
|
|
|
//计算受累、故障
|
|
|
- calcBurdened(stateCauseList,thingId,advanceTime, ts,5,doubleValue);
|
|
|
- }else if(advanceState==7){
|
|
|
+ calcBurdened(stateCauseList, thingId, advanceTime, ts, 5, doubleValue);
|
|
|
+ } else if (advanceState == 7) {
|
|
|
//计算受累、故障、计划检修
|
|
|
- calcBurdened(stateCauseList,thingId,advanceTime, ts,7,doubleValue);
|
|
|
- }else if(advanceState==0){
|
|
|
- if(ts-advanceTime<appConfig.getLongTime().get("fault-min")) continue;
|
|
|
- StateCause cause = new StateCause(thingId2StationId(thingId),thingId, stateMap.get(5.0),
|
|
|
- new Date(advanceTime),new Date(ts), stateMap.get(0.0),stateMap.get(doubleValue),ts -advanceTime);
|
|
|
+ calcBurdened(stateCauseList, thingId, advanceTime, ts, 7, doubleValue);
|
|
|
+ } else if (advanceState == 0) {
|
|
|
+ if (ts - advanceTime < appConfig.getLongTime().get("fault-min")) continue;
|
|
|
+ StateCause cause = new StateCause(thingId2StationId(thingId), thingId, stateMap.get(5.0),
|
|
|
+ new Date(advanceTime), new Date(ts), stateMap.get(0.0), stateMap.get(doubleValue), ts - advanceTime);
|
|
|
stateCauseList.add(cause);
|
|
|
}
|
|
|
|
|
@@ -147,44 +148,44 @@ public class CalculateService {
|
|
|
* 判断限停
|
|
|
*/
|
|
|
private boolean judgmentStop(String thingId, long start, long end) {
|
|
|
- if(hasFaultEvent(thingId,start,end)) return false;
|
|
|
+ if (hasFaultEvent(thingId, start, end)) return false;
|
|
|
Booststation boostStation = thingId2BoostStation(thingId);
|
|
|
TestingPoint apsTp = CacheContext.pointMapMap.get("active-power-set").get(boostStation.getId());
|
|
|
- List<PointData> apsRbk = adapterApi.getValuesByKey(apsTp.getCode(), start, end,30);
|
|
|
- if(apsRbk.isEmpty()) return false;
|
|
|
+ List<PointData> apsRbk = adapterApi.getValuesByKey(apsTp.getCode(), start, end, 30);
|
|
|
+ if (apsRbk.isEmpty()) return false;
|
|
|
TestingPoint apTp = CacheContext.pointMapMap.get("apparent-power").get(boostStation.getId());
|
|
|
- List<PointData> apRbk = adapterApi.getValuesByKey(apTp.getCode(), start, end,30);
|
|
|
- if(apRbk.isEmpty()) return false;
|
|
|
+ List<PointData> apRbk = adapterApi.getValuesByKey(apTp.getCode(), start, end, 30);
|
|
|
+ if (apRbk.isEmpty()) return false;
|
|
|
TestingPoint opTp = CacheContext.pointMapMap.get("output-power").get(boostStation.getId());
|
|
|
- List<PointData> opRbk = adapterApi.getValuesByKey(opTp.getCode(), start, end,30);
|
|
|
- if(opRbk.isEmpty()) return false;
|
|
|
+ List<PointData> opRbk = adapterApi.getValuesByKey(opTp.getCode(), start, end, 30);
|
|
|
+ if (opRbk.isEmpty()) return false;
|
|
|
//有功设定
|
|
|
- double apsDouble = apsRbk.stream().mapToDouble(PointData::getDoubleValue).average().getAsDouble()*(apsTp.getRate()==null?1:apsTp.getRate());
|
|
|
+ double apsDouble = apsRbk.stream().mapToDouble(PointData::getDoubleValue).average().getAsDouble() * (apsTp.getRate() == null ? 1 : apsTp.getRate());
|
|
|
//应发功率
|
|
|
double apDouble = 0;
|
|
|
- if(boostStation.getId().contains("QS")){
|
|
|
- TestingPoint apTp2 = CacheContext.pointMapMap.get("apparent-power").get(boostStation.getId()+"2");
|
|
|
- List<PointData> apRbk2 = adapterApi.getValuesByKey(apTp2.getCode(), start, end,30);
|
|
|
- if(apRbk2.isEmpty()) return false;
|
|
|
- apDouble = apRbk.stream().mapToDouble(PointData::getDoubleValue).average().getAsDouble()*(apTp.getRate()==null?1:apTp.getRate());
|
|
|
- apDouble+=apRbk2.stream().mapToDouble(PointData::getDoubleValue).average().getAsDouble()*(apTp.getRate()==null?1:apTp.getRate());
|
|
|
-
|
|
|
- }else {
|
|
|
- apDouble = apRbk.stream().mapToDouble(PointData::getDoubleValue).average().getAsDouble()*(apTp.getRate()==null?1:apTp.getRate());
|
|
|
+ if (boostStation.getId().contains("QS")) {
|
|
|
+ TestingPoint apTp2 = CacheContext.pointMapMap.get("apparent-power").get(boostStation.getId() + "2");
|
|
|
+ List<PointData> apRbk2 = adapterApi.getValuesByKey(apTp2.getCode(), start, end, 30);
|
|
|
+ if (apRbk2.isEmpty()) return false;
|
|
|
+ apDouble = apRbk.stream().mapToDouble(PointData::getDoubleValue).average().getAsDouble() * (apTp.getRate() == null ? 1 : apTp.getRate());
|
|
|
+ apDouble += apRbk2.stream().mapToDouble(PointData::getDoubleValue).average().getAsDouble() * (apTp.getRate() == null ? 1 : apTp.getRate());
|
|
|
+
|
|
|
+ } else {
|
|
|
+ apDouble = apRbk.stream().mapToDouble(PointData::getDoubleValue).average().getAsDouble() * (apTp.getRate() == null ? 1 : apTp.getRate());
|
|
|
}
|
|
|
//出线功率
|
|
|
- double opDouble = opRbk.stream().mapToDouble(PointData::getDoubleValue).average().getAsDouble()*(opTp.getRate()==null?1:opTp.getRate());
|
|
|
+ double opDouble = opRbk.stream().mapToDouble(PointData::getDoubleValue).average().getAsDouble() * (opTp.getRate() == null ? 1 : opTp.getRate());
|
|
|
//有功设定小于出线功率
|
|
|
- if(apsDouble<opDouble) return true;
|
|
|
+ if (apsDouble < opDouble) return true;
|
|
|
//有功设定小于应发的85% 并且 出线功率大于有功设定94%
|
|
|
- if(apsDouble<=apDouble*0.85&&opDouble>=apsDouble*0.94) return true;
|
|
|
+ if (apsDouble <= apDouble * 0.85 && opDouble >= apsDouble * 0.94) return true;
|
|
|
|
|
|
//List<StateCause> collect = stateCauseList.stream().filter(sc -> stationid.equals(sc.getStationId()) && stateMap.get(8.0).equals(sc.getEvent())
|
|
|
// && sc.getStartTime().getTime() >= start && sc.getEndTime().getTime() <= end).collect(Collectors.toList());
|
|
|
|
|
|
//有功设定小于应发的70% 并且 出线功率大于有功设定80% 并且 当前场站限电台数大于等于3
|
|
|
String stationid = thingId2StationId(thingId);
|
|
|
- return apsDouble <= apDouble * 0.7 && opDouble >= apsDouble * 0.8 && electricityRationCount(stationid, start,end) >= 3;
|
|
|
+ return apsDouble <= apDouble * 0.7 && opDouble >= apsDouble * 0.8 && electricityRationCount(stationid, start, end) >= 3;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -201,10 +202,10 @@ public class CalculateService {
|
|
|
String activePowerStr = CacheContext.pointMapMap.get("active-power").get(equipment.getId()).getCode();
|
|
|
//String s = new StringBuilder().append(speedStr).append(",").append(bladeAngleStr).append(",").append(activePowerStr).toString();
|
|
|
//Map<String, PointData> historySection = adapterApi.getHistorySection(s, end);
|
|
|
- List<PointData> speedPdl = adapterApi.getValuesByKey(speedStr, start, end,30);
|
|
|
- List<PointData> bladeAnglePdl = adapterApi.getValuesByKey(bladeAngleStr, start, end,30);
|
|
|
- List<PointData> activePowerPdl = adapterApi.getValuesByKey(activePowerStr, start, end,30);
|
|
|
- if(bladeAnglePdl.size()<speedPdl.size()||activePowerPdl.size()<speedPdl.size()) continue;
|
|
|
+ List<PointData> speedPdl = adapterApi.getValuesByKey(speedStr, start, end, 30);
|
|
|
+ List<PointData> bladeAnglePdl = adapterApi.getValuesByKey(bladeAngleStr, start, end, 30);
|
|
|
+ List<PointData> activePowerPdl = adapterApi.getValuesByKey(activePowerStr, start, end, 30);
|
|
|
+ if (bladeAnglePdl.size() < speedPdl.size() || activePowerPdl.size() < speedPdl.size()) continue;
|
|
|
|
|
|
double incount = 0;
|
|
|
for (int i = 0; i < speedPdl.size(); i++) {
|
|
@@ -212,12 +213,12 @@ public class CalculateService {
|
|
|
if (speedPdl.get(i).getDoubleValue() <= modelPower.getSpeed() && bladeAnglePdl.get(i).getDoubleValue() > 2) {
|
|
|
incount++;
|
|
|
//风速大于11并且有功功率小于满发功率减100
|
|
|
- } else if (speedPdl.get(i).getDoubleValue() > modelPower.getSpeed() && activePowerPdl.get(i).getDoubleValue() < modelPower.getTheoryPower()-100) {
|
|
|
+ } else if (speedPdl.get(i).getDoubleValue() > modelPower.getSpeed() && activePowerPdl.get(i).getDoubleValue() < modelPower.getTheoryPower() - 100) {
|
|
|
incount++;
|
|
|
}
|
|
|
}
|
|
|
- if(incount/speedPdl.size()>0.5) count++;
|
|
|
- if(count>3) return count;
|
|
|
+ if (incount / speedPdl.size() > 0.5) count++;
|
|
|
+ if (count > 3) return count;
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
@@ -227,23 +228,23 @@ public class CalculateService {
|
|
|
*/
|
|
|
private boolean hasFaultEvent(String thingId, long start, long end) {
|
|
|
List<FaultInfo> fjInfos = fjGzMap.get(CacheContext.equipMap.get(thingId).getCode());
|
|
|
- fjInfos=fjInfos==null?null:fjInfos.stream().filter(fi->timeBetweenBefore30(fi.getFaultTime().getTime(),start,end)).collect(Collectors.toList());
|
|
|
+ fjInfos = fjInfos == null ? null : fjInfos.stream().filter(fi -> timeBetweenBefore30(fi.getFaultTime().getTime(), start, end)).collect(Collectors.toList());
|
|
|
|
|
|
- if(fjInfos!=null&&fjInfos.size()>0){
|
|
|
+ if (fjInfos != null && fjInfos.size() > 0) {
|
|
|
Map<String, List<FaultInfo>> map = fjInfos.stream().collect(Collectors.groupingBy(FaultInfo::getAlertText));
|
|
|
//判断当前故障是触发还是解除
|
|
|
for (List<FaultInfo> value : map.values()) {
|
|
|
- if(value.get(0).getMessageType()==1) return true;
|
|
|
+ if (value.get(0).getMessageType() == 1) return true;
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
String stationid = thingId2StationId(thingId);
|
|
|
List<FaultInfo> syzInfos = syzGzMap.get(CacheContext.stationMap.get(stationid).getCode());
|
|
|
- syzInfos=syzInfos==null?null:syzInfos.stream().filter(fi->timeBetweenBefore30(fi.getFaultTime().getTime(),start,end)).collect(Collectors.toList());
|
|
|
- if(syzInfos!=null&&syzInfos.size()>0){
|
|
|
+ syzInfos = syzInfos == null ? null : syzInfos.stream().filter(fi -> timeBetweenBefore30(fi.getFaultTime().getTime(), start, end)).collect(Collectors.toList());
|
|
|
+ if (syzInfos != null && syzInfos.size() > 0) {
|
|
|
Map<String, List<FaultInfo>> map = syzInfos.stream().collect(Collectors.groupingBy(FaultInfo::getAlertText));
|
|
|
//判断当前故障是分位状态
|
|
|
for (List<FaultInfo> value : map.values()) {
|
|
|
- if(value.get(0).getConfirmPerson().equals("--分位状态")) return true;
|
|
|
+ if (value.get(0).getConfirmPerson().equals("--分位状态")) return true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -309,7 +310,7 @@ public class CalculateService {
|
|
|
List<List<PointData>> stationState = new ArrayList<>();
|
|
|
//当前风机的场站所有风机
|
|
|
List<TestingPoint> points = state8.values().stream().filter(tp -> stationId.equals(tp.getStationId())).collect(Collectors.toList());
|
|
|
- points.forEach(tp->{
|
|
|
+ points.forEach(tp -> {
|
|
|
List<PointData> valuesByKey = adapterApi.getValuesByKey(state8.get(tp.getThingId()).getCode(), start, end, 30);
|
|
|
stationState.add(valuesByKey);
|
|
|
});
|
|
@@ -319,7 +320,7 @@ public class CalculateService {
|
|
|
for (int i = 0; i < size; i++) {
|
|
|
int finalI = i;
|
|
|
boolean b = stationState.stream().filter(pds -> pds.get(finalI).getDoubleValue() == starteventstate).count() == stationState.size();
|
|
|
- if(b){
|
|
|
+ if (b) {
|
|
|
k++;
|
|
|
}
|
|
|
/*if(b){
|
|
@@ -347,15 +348,15 @@ public class CalculateService {
|
|
|
isBurdened = false;
|
|
|
}*/
|
|
|
}
|
|
|
- if(k/size>9.5){
|
|
|
+ if (k / size > 9.5) {
|
|
|
//受累
|
|
|
- StateCause cause = new StateCause(stationId,thingId,stateMap.get(10.0),new Date(start),new Date(end),
|
|
|
- stateMap.get(starteventstate),stateMap.get(endeventstate),end - start);
|
|
|
+ StateCause cause = new StateCause(stationId, thingId, stateMap.get(10.0), new Date(start), new Date(end),
|
|
|
+ stateMap.get(starteventstate), stateMap.get(endeventstate), end - start);
|
|
|
stateCauseList.add(cause);
|
|
|
- }else {//if(starteventstate==5 || isHasFaultEvent(thingId,start,end)){
|
|
|
+ } else {//if(starteventstate==5 || isHasFaultEvent(thingId,start,end)){
|
|
|
//故障
|
|
|
- StateCause cause = new StateCause(stationId,thingId,stateMap.get(5.0),new Date(start),new Date(end),
|
|
|
- stateMap.get(starteventstate),stateMap.get(endeventstate),end - start);
|
|
|
+ StateCause cause = new StateCause(stationId, thingId, stateMap.get(5.0), new Date(start), new Date(end),
|
|
|
+ stateMap.get(starteventstate), stateMap.get(endeventstate), end - start);
|
|
|
stateCauseList.add(cause);
|
|
|
}/*else {
|
|
|
//计划检修
|
|
@@ -367,9 +368,10 @@ public class CalculateService {
|
|
|
|
|
|
/**
|
|
|
* 计算限电
|
|
|
+ *
|
|
|
* @param equipment 设备id
|
|
|
- * @param start 并网开始时间
|
|
|
- * @param end 并网结束时间
|
|
|
+ * @param start 并网开始时间
|
|
|
+ * @param end 并网结束时间
|
|
|
*/
|
|
|
private LinkedHashMap<Long, Long> calcElectricityRation(String equipment, long start, long end) {
|
|
|
//满发功率和满发最小风速
|
|
@@ -378,7 +380,8 @@ public class CalculateService {
|
|
|
List<PointData> speedList = adapterApi.getValuesByKey(CacheContext.pointMapMap.get("speed").get(equipment).getCode(), start, end, 5);
|
|
|
List<PointData> bladeAngleList = adapterApi.getValuesByKey(CacheContext.pointMapMap.get("blade-angle").get(equipment).getCode(), start, end, 5);
|
|
|
List<PointData> activePowerList = adapterApi.getValuesByKey(CacheContext.pointMapMap.get("active-power").get(equipment).getCode(), start, end, 5);
|
|
|
- if(bladeAngleList.size()<speedList.size()||activePowerList.size()<speedList.size()) return new LinkedHashMap<>();
|
|
|
+ if (bladeAngleList.size() < speedList.size() || activePowerList.size() < speedList.size())
|
|
|
+ return new LinkedHashMap<>();
|
|
|
//是否限电
|
|
|
boolean isElectricityRation = false;
|
|
|
//限电开始时间
|
|
@@ -401,18 +404,18 @@ public class CalculateService {
|
|
|
//风速小于11并且桨叶角度大于2
|
|
|
if (speedPd <= modelPower.getSpeed() && bladeAnglePd > 2) {
|
|
|
//限电首次时间
|
|
|
- if(!isElectricityRation){
|
|
|
+ if (!isElectricityRation) {
|
|
|
ts1 = ts;
|
|
|
}
|
|
|
isElectricityRation = true;
|
|
|
//风速大于11并且有功功率小于满发功率减100
|
|
|
- } else if (speedPd > modelPower.getSpeed() && activePowerPd < modelPower.getTheoryPower()-100) {
|
|
|
+ } else if (speedPd > modelPower.getSpeed() && activePowerPd < modelPower.getTheoryPower() - 100) {
|
|
|
//限电首次时间
|
|
|
- if(!isElectricityRation){
|
|
|
+ if (!isElectricityRation) {
|
|
|
ts1 = ts;
|
|
|
}
|
|
|
isElectricityRation = true;
|
|
|
- }else if(isElectricityRation){
|
|
|
+ } else if (isElectricityRation) {
|
|
|
//记录限电
|
|
|
llm.put(ts1, ts);
|
|
|
/*StateCause cause;
|
|
@@ -435,18 +438,18 @@ public class CalculateService {
|
|
|
LinkedHashMap<Long, Long> llm2 = new LinkedHashMap<>();
|
|
|
//限电列表key2-key1小于3分钟,记录为一个限电,大于3分钟,记录为另一个限电
|
|
|
for (Map.Entry<Long, Long> entry : llm.entrySet()) {
|
|
|
- if(t0==0) {
|
|
|
+ if (t0 == 0) {
|
|
|
t0 = entry.getKey();
|
|
|
tstart = entry.getKey();
|
|
|
- tend=llm.get(t0);
|
|
|
+ tend = llm.get(t0);
|
|
|
continue;
|
|
|
}
|
|
|
t1 = entry.getKey();
|
|
|
if (t1 - t0 < appConfig.getLongTime().get("ration")) {
|
|
|
tend = llm.get(t1);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//3分钟内的限电忽略
|
|
|
- if(tend-tstart>appConfig.getLongTime().get("ration-min")){
|
|
|
+ if (tend - tstart > appConfig.getLongTime().get("ration-min")) {
|
|
|
llm2.put(tstart, tend);
|
|
|
}
|
|
|
tend = llm.get(t1);
|
|
@@ -454,7 +457,7 @@ public class CalculateService {
|
|
|
}
|
|
|
t0 = t1;
|
|
|
}
|
|
|
- if(tend-tstart>appConfig.getLongTime().get("ration-min")){
|
|
|
+ if (tend - tstart > appConfig.getLongTime().get("ration-min")) {
|
|
|
llm2.put(tstart, tend);
|
|
|
}
|
|
|
return llm2;
|