|
@@ -0,0 +1,980 @@
|
|
|
|
+package com.gyee.generation.service;
|
|
|
|
+
|
|
|
|
+import com.alibaba.druid.sql.ast.TDDLHint;
|
|
|
|
+import com.gyee.common.contant.Contant;
|
|
|
|
+import com.gyee.common.model.DNAVal;
|
|
|
|
+import com.gyee.common.model.PointData;
|
|
|
|
+import com.gyee.generation.init.CacheContext;
|
|
|
|
+import com.gyee.generation.model.auto.*;
|
|
|
|
+import com.gyee.generation.service.auto.*;
|
|
|
|
+import com.gyee.generation.util.DateUtils;
|
|
|
|
+import com.gyee.generation.util.StringUtils;
|
|
|
|
+import com.gyee.generation.util.realtimesource.IEdosUtil;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+public class ShutdownService {
|
|
|
|
+
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(ShutdownService.class);
|
|
|
|
+ @Resource
|
|
|
|
+ private IEdosUtil edosUtil;
|
|
|
|
+ private final String ALARMHISTORY="ALARMHISTORY";
|
|
|
|
+ @Resource
|
|
|
|
+ private IProEconWtPowerCurveFittingService proEconWtPowerCurveFittingService;
|
|
|
|
+ @Resource
|
|
|
|
+ private IProEconWindturbineStatusService proEconWindturbineStatusService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private IProEconShutdownEventService proEconShutdownEventService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private IProEconShutdownEvent2Service proEconShutdownEvent2Service;
|
|
|
|
+ @Resource
|
|
|
|
+ private IProEconInterruptionService proEconInterruptionService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private IProEconInputOrOutputSpeedService proEconInputOrOutputSpeedService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private IProEconActivePowerDataService proEconActivePowerDataService;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private static Logger logger = LoggerFactory.getLogger(ShutdownService.class);
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 风机状态测点,key为风机编号
|
|
|
|
+ /// </summary>
|
|
|
|
+ private Map<String, ProBasicEquipmentPoint> statusPoints = new HashMap<String, ProBasicEquipmentPoint>();
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 风机功率测点,key为风机编号
|
|
|
|
+ /// </summary>
|
|
|
|
+ private Map<String, ProBasicEquipmentPoint> powerPoints = new HashMap<String, ProBasicEquipmentPoint>();
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 风机当前状态,key为风机编号
|
|
|
|
+ /// </summary>
|
|
|
|
+ private Map<String, Integer> status = new HashMap<String, Integer>();
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 保存风机信息,key为风机编号
|
|
|
|
+ /// </summary>
|
|
|
|
+ private Map<String, ProBasicWindturbine> windTurbines = new HashMap<String, ProBasicWindturbine>();
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 风机状态说明,key为状态码,value为状态说明
|
|
|
|
+ /// </summary>
|
|
|
|
+ private Map<Integer, String> statusDescription = new HashMap<Integer, String>();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private Date date = new Date();
|
|
|
|
+
|
|
|
|
+ Map<String, ProEconWindturbineStatus> oldStatusMap = new HashMap<String, ProEconWindturbineStatus>();
|
|
|
|
+ Map<String, ProEconShutdownEvent> oldShutdownEvent = new HashMap<String, ProEconShutdownEvent>();
|
|
|
|
+ Map<String, ProEconInterruption> oldInterrup = new HashMap<String, ProEconInterruption>();
|
|
|
|
+
|
|
|
|
+ //新增shutdownevent2 实时
|
|
|
|
+ Map<String, ProEconShutdownEvent2> oldShutdownEvent2 = new HashMap<String, ProEconShutdownEvent2>();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 风机功率 key为风机编号
|
|
|
|
+ /// </summary>
|
|
|
|
+ Map<String, ProBasicEquipmentPoint> powerpointMap = new HashMap<String, ProBasicEquipmentPoint>();//功率
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 风机风速 key为风机编号
|
|
|
|
+ /// </summary>
|
|
|
|
+ Map<String, ProBasicEquipmentPoint> speedpointMap = new HashMap<String, ProBasicEquipmentPoint>();//风速
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 测风塔风速 key为风场编号
|
|
|
|
+ /// </summary>
|
|
|
|
+ Map<String, ProBasicWppoint> gzdpointMap = new HashMap<String, ProBasicWppoint>();//测风塔风速
|
|
|
|
+ /// <summary>
|
|
|
|
+ ///
|
|
|
|
+ /// </summary>
|
|
|
|
+// Map<String, Map<Double, ProBasicModelPower>> modelPowerMap = new HashMap<String, Map<Double, ProBasicModelPower>>();
|
|
|
|
+ //不在从新拟合功率曲线,从数据库中直接取值
|
|
|
|
+ Map<String, Map<Double, ProEconWtPowerCurveFitting>> modelPowerMap = new HashMap<String, Map<Double, ProEconWtPowerCurveFitting>>();
|
|
|
|
+ Map<String, ProBasicWindpowerstation> windpowerMap;//风场
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Value("${shutdown.keystr}")
|
|
|
|
+ private String[] keystr;
|
|
|
|
+
|
|
|
|
+ public void Init()
|
|
|
|
+ {
|
|
|
|
+ statusDescription.put(0, "待机");
|
|
|
|
+ statusDescription.put(1, "并网");
|
|
|
|
+ statusDescription.put(2, "停机");
|
|
|
|
+ statusDescription.put(3, "通讯中断");
|
|
|
|
+ statusDescription.put(4, "维护");
|
|
|
|
+ statusDescription.put(5, "限电");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String[] appStr = new String[keystr.length];
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < keystr.length; i++)
|
|
|
|
+ {
|
|
|
|
+ appStr[i] = keystr[i];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ windpowerMap = CacheContext.wpmap;
|
|
|
|
+
|
|
|
|
+ List<ProBasicEquipmentPoint> items=new ArrayList<>();
|
|
|
|
+ List<ProBasicEquipmentPoint> powerpointList = new ArrayList<>();
|
|
|
|
+ List<ProBasicEquipmentPoint> speedpointList = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ List<ProBasicWindturbine> wtls= CacheContext.wtls;
|
|
|
|
+ Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap=CacheContext.wtpAimap;
|
|
|
|
+ //筛选风机对应测点
|
|
|
|
+ wtls.stream().forEach(wt->{
|
|
|
|
+ Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
|
|
|
|
+ if(windturbinetestingpointnewMap.containsKey(Contant.FJ5T))
|
|
|
|
+ {
|
|
|
|
+ ProBasicEquipmentPoint mxztPoint = windturbinetestingpointnewMap.get(Contant.FJ5T);
|
|
|
|
+
|
|
|
|
+ items.add(mxztPoint);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(windturbinetestingpointnewMap.containsKey(Contant.AI130))
|
|
|
|
+ {
|
|
|
|
+ ProBasicEquipmentPoint ygglPoint = windturbinetestingpointnewMap.get(Contant.AI130);
|
|
|
|
+
|
|
|
|
+ powerPoints.put(ygglPoint.getCode(),ygglPoint);
|
|
|
|
+ powerpointList.add(ygglPoint);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(windturbinetestingpointnewMap.containsKey(Contant.AI022))
|
|
|
|
+ {
|
|
|
|
+ ProBasicEquipmentPoint mxztPoint = windturbinetestingpointnewMap.get(Contant.AI022);
|
|
|
|
+
|
|
|
|
+ speedpointList.add(mxztPoint);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ //进行测点排序
|
|
|
|
+ powerpointList.sort(Comparator.comparing(ProBasicEquipmentPoint::getWindturbineId));
|
|
|
|
+ speedpointList.sort(Comparator.comparing(ProBasicEquipmentPoint::getWindturbineId));
|
|
|
|
+
|
|
|
|
+ for (ProBasicEquipmentPoint item : items)
|
|
|
|
+ {
|
|
|
|
+ statusPoints.put(item.getWindturbineId(), item);
|
|
|
|
+ status.put(item.getWindturbineId(), -1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ windTurbines=CacheContext.wtmap;
|
|
|
|
+ List<ProBasicWppoint> gzdpointList =new ArrayList<>();
|
|
|
|
+ CacheContext.wpls.stream().forEach(wp->{
|
|
|
|
+
|
|
|
|
+ Map<String, ProBasicWppoint> wppointsmap = CacheContext.wppointmap.get(wp.getId());
|
|
|
|
+ if(wppointsmap.containsKey(Contant.IRRAD))
|
|
|
|
+ {
|
|
|
|
+ ProBasicWppoint mxztPoint = wppointsmap.get(Contant.IRRAD);
|
|
|
|
+
|
|
|
|
+ gzdpointList.add(mxztPoint);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ for (Integer i = 0; i < powerpointList.size(); i++)
|
|
|
|
+ {
|
|
|
|
+ if (powerpointMap.containsKey(powerpointList.get(i).getWindturbineId()))
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ powerpointMap.put(powerpointList.get(i).getWindturbineId(), powerpointList.get(i));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (Integer i = 0; i < speedpointList.size(); i++)
|
|
|
|
+ {
|
|
|
|
+ if (speedpointMap.containsKey(speedpointList.get(i).getWindturbineId()))
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ speedpointMap.put(speedpointList.get(i).getWindturbineId(), speedpointList.get(i));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (Integer i = 0; i < gzdpointList.size(); i++)
|
|
|
|
+ {
|
|
|
|
+ if (gzdpointMap.containsKey(gzdpointList.get(i).getWindpowerstationId()))
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ gzdpointMap.put(gzdpointList.get(i).getWindpowerstationId(), gzdpointList.get(i));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ wtls.stream().forEach(wt->{
|
|
|
|
+
|
|
|
|
+ List<ProEconWtPowerCurveFitting> wtpcfidls=proEconWtPowerCurveFittingService.list().stream()
|
|
|
|
+ .filter(i->i.getWindturbineId().equals(wt.getId()))
|
|
|
|
+ .sorted(Comparator.comparing(ProEconWtPowerCurveFitting::getSpeed)).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ Map<Double, ProEconWtPowerCurveFitting> map = new HashMap<Double, ProEconWtPowerCurveFitting>();
|
|
|
|
+ if(!wtpcfidls.isEmpty())
|
|
|
|
+ {
|
|
|
|
+ for(ProEconWtPowerCurveFitting pwpcf:wtpcfidls)
|
|
|
|
+ {
|
|
|
|
+ map.put(pwpcf.getSpeed(),pwpcf);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ modelPowerMap.put(wt.getId(),map);
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void exec() throws Exception {
|
|
|
|
+ oldStatusMap.clear();
|
|
|
|
+ oldShutdownEvent.clear();
|
|
|
|
+ oldInterrup.clear();
|
|
|
|
+ oldShutdownEvent2.clear();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ logger.debug("{0}开始", date);
|
|
|
|
+ //循环读取所有风机的当前状态,并且给几个缓存字典初始化
|
|
|
|
+ for (String key : statusPoints.keySet())
|
|
|
|
+ {
|
|
|
|
+ //取实时状态数据 赋值给status
|
|
|
|
+ double power = 0;
|
|
|
|
+ if (powerPoints.containsKey(key))
|
|
|
|
+ {
|
|
|
|
+ power = StringUtils.round(edosUtil.getRealData(powerPoints.get(key).getCode()).getPointValueInDouble(),2);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ Double value = StringUtils.round(edosUtil.getRealData(statusPoints.get(key).getCode()).getPointValueInDouble(),2);
|
|
|
|
+
|
|
|
|
+ if (power > 1)
|
|
|
|
+ {
|
|
|
|
+ status.put(key,value == 5 ? 1 : value.intValue());
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ status.put(key,value == 5 ? 0 : value.intValue());
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ oldStatusMap.put(key, null);
|
|
|
|
+ oldShutdownEvent.put(key, null);
|
|
|
|
+ oldInterrup.put(key, null);
|
|
|
|
+
|
|
|
|
+ // 新增 shutdownevent2 实时
|
|
|
|
+ oldShutdownEvent2.put(key, null);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //读取oracle中 五种小时数、停机记录、中断记录
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //读取数据库存在的恢复时间为NULL的数据
|
|
|
|
+ List<ProEconWindturbineStatus> oldStatusQuery=proEconWindturbineStatusService.list().stream()
|
|
|
|
+ .filter(i->StringUtils.empty(i.getStartTime()))
|
|
|
|
+ .sorted(Comparator.comparing(ProEconWindturbineStatus::getStopTime)).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ for (ProEconWindturbineStatus oldStatus : oldStatusQuery)
|
|
|
|
+ {
|
|
|
|
+ if (oldStatusMap.containsKey(oldStatus.getWindturbineId()))
|
|
|
|
+ {
|
|
|
|
+ oldStatusMap.put(oldStatus.getWindturbineId(),oldStatus);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<ProEconShutdownEvent> oldShutdwonQuery=proEconShutdownEventService.list().stream()
|
|
|
|
+ .filter(i->StringUtils.empty(i.getStartTime()))
|
|
|
|
+ .sorted(Comparator.comparing(ProEconShutdownEvent::getStopTime)).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ for (ProEconShutdownEvent shutdown : oldShutdwonQuery)
|
|
|
|
+ {
|
|
|
|
+ if (oldShutdownEvent.containsKey(shutdown.getWindturbineId()))
|
|
|
|
+ {
|
|
|
|
+ oldShutdownEvent.put(shutdown.getWindturbineId(),shutdown);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<ProEconInterruption> oldInterrupQuery=proEconInterruptionService.list().stream()
|
|
|
|
+ .filter(i->StringUtils.empty(i.getStartTime()))
|
|
|
|
+ .sorted(Comparator.comparing(ProEconInterruption::getStopTime)).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ for (ProEconInterruption interrup : oldInterrupQuery)
|
|
|
|
+ {
|
|
|
|
+ if (oldInterrup.containsKey(interrup.getWindturbineId()))
|
|
|
|
+ {
|
|
|
|
+ oldInterrup.put(interrup.getWindturbineId(),interrup);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 新增 shutdownevent2 实时
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<ProEconShutdownEvent2> oldShutdwonQuery2=proEconShutdownEvent2Service.list().stream()
|
|
|
|
+ .filter(i->StringUtils.empty(i.getStartTime()))
|
|
|
|
+ .sorted(Comparator.comparing(ProEconShutdownEvent2::getStopTime)).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ for (ProEconShutdownEvent2 shutdown : oldShutdwonQuery2)
|
|
|
|
+ {
|
|
|
|
+ if (oldShutdownEvent2.containsKey(shutdown.getWindturbineId()))
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ oldShutdownEvent2.put(shutdown.getWindturbineId(),shutdown);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ for (String s : oldStatusMap.keySet())
|
|
|
|
+ {
|
|
|
|
+ ProEconWindturbineStatus item = oldStatusMap.get(s);
|
|
|
|
+
|
|
|
|
+ if (item == null)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ //logger.debug("{0}重复加入 风机编号{1}", date,s);
|
|
|
|
+
|
|
|
|
+ ProEconShutdownEvent shutdwonEvent=null;
|
|
|
|
+ ProEconInterruption interrup=null;
|
|
|
|
+
|
|
|
|
+ //region 新增 shutdownevent2 实时
|
|
|
|
+ ProEconShutdownEvent2 shutdwonEvent2=null;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ item = buildWindturbineStatus(s, date, shutdwonEvent, interrup, shutdwonEvent2);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ proEconWindturbineStatusService.save(item);
|
|
|
|
+
|
|
|
|
+ if (shutdwonEvent != null)
|
|
|
|
+ {
|
|
|
|
+ proEconShutdownEventService.save(shutdwonEvent);
|
|
|
|
+ }
|
|
|
|
+ if (interrup != null)
|
|
|
|
+ {
|
|
|
|
+ proEconInterruptionService.save(interrup);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 新增 shutdownevent2 实时
|
|
|
|
+ if (shutdwonEvent2 != null)
|
|
|
|
+ {
|
|
|
|
+ //20分钟以内的报警数据
|
|
|
|
+ Date dtbegin = DateUtils.addMinutes(shutdwonEvent2.getStopTime(),-15);
|
|
|
|
+ Date dtend = shutdwonEvent2.getStopTime();
|
|
|
|
+
|
|
|
|
+ Optional<ProEconShutdownEvent2> olditem=proEconShutdownEvent2Service.list().stream()
|
|
|
|
+ .filter(i->i.getWindturbineId().equals(s)
|
|
|
|
+ && ( i.getStartTime().compareTo(dtbegin)==0 || i.getStartTime().after(dtbegin))
|
|
|
|
+ && (i.getStartTime().compareTo(dtend)==0 || i.getStartTime().before(dtend))
|
|
|
|
+
|
|
|
|
+ ).sorted(Comparator.comparing(ProEconShutdownEvent2::getStartTime)).findFirst();
|
|
|
|
+
|
|
|
|
+ ProEconShutdownEvent2 temp=null;
|
|
|
|
+ if (!olditem.isPresent())
|
|
|
|
+ {
|
|
|
|
+ proEconShutdownEvent2Service.save(shutdwonEvent2);
|
|
|
|
+ temp=olditem.get();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ olditem.get().setStartTime(null);
|
|
|
|
+ if (null !=temp && !oldShutdownEvent2.containsKey(temp.getWindturbineId()))
|
|
|
|
+ oldShutdownEvent2.put(temp.getWindturbineId(), temp);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Calendar c=Calendar.getInstance();
|
|
|
|
+ c.setTime(date);
|
|
|
|
+ if (c.get(Calendar.HOUR_OF_DAY) == 0 &&c.get(Calendar.MINUTE) == 0)
|
|
|
|
+ {
|
|
|
|
+ logger.debug("{0}--整点操作--{1}", s, date);
|
|
|
|
+
|
|
|
|
+ updateAndAddStatus( item);
|
|
|
|
+ }
|
|
|
|
+ else if (((Integer)item.getSatusCode()) != status.get(s))
|
|
|
|
+ {
|
|
|
|
+ updateAndAddStatus(item);
|
|
|
|
+
|
|
|
|
+ // #region 切入切出风速
|
|
|
|
+ if (((Integer)item.getSatusCode()) == 0 && status.get(s) == 1)
|
|
|
|
+ {
|
|
|
|
+ ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
|
|
|
|
+ input.setWindturbineId(s);
|
|
|
|
+ input.setWindpowerstationId(windTurbines.get(s).getWindpowerstationId());
|
|
|
|
+ input.setProjectId(windTurbines.get(s).getProjectId());
|
|
|
|
+ input.setLineId(windTurbines.get(s).getLineId());
|
|
|
|
+ input.setRecordDate(date);
|
|
|
|
+ input.setInputOrOutput(1);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (speedpointMap.containsKey(s))
|
|
|
|
+ {
|
|
|
|
+ double value =edosUtil.getRealData(speedpointMap.get(s).getCode()).getPointValueInDouble();
|
|
|
|
+ input.setSpeed(value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ proEconInputOrOutputSpeedService.save(input);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else if (((Integer)item.getSatusCode()) == 1 && status.get(s)== 0)
|
|
|
|
+ {
|
|
|
|
+ ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
|
|
|
|
+ input.setWindturbineId(s);
|
|
|
|
+ input.setWindpowerstationId(windTurbines.get(s).getWindpowerstationId());
|
|
|
|
+ input.setProjectId(windTurbines.get(s).getProjectId());
|
|
|
|
+ input.setLineId(windTurbines.get(s).getLineId());
|
|
|
|
+ input.setRecordDate(date);
|
|
|
|
+ input.setInputOrOutput(0);
|
|
|
|
+ if (speedpointMap.containsKey(s))
|
|
|
|
+ {
|
|
|
|
+ double value =edosUtil.getRealData(speedpointMap.get(s).getCode()).getPointValueInDouble();
|
|
|
|
+ input.setSpeed(value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ proEconInputOrOutputSpeedService.save(input);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ updateAndAddStatus2(item);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ logger.debug("{0}-------结束", date);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 计算损失电量
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="entities"></param>
|
|
|
|
+ /// <param name="status"></param>
|
|
|
|
+ private void updateAndAddStatus2(ProEconWindturbineStatus status) throws Exception {
|
|
|
|
+ Integer oldStatus = (Integer)status.getSatusCode();
|
|
|
|
+ if (oldStatus == 2 || oldStatus == 4)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ ProEconShutdownEvent ose = oldShutdownEvent.get(status.getWindturbineId());
|
|
|
|
+ if (ose != null)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ Double timehour=DateUtils.hoursDiff2(date,ose.getStopTime());
|
|
|
|
+ Double gc = calcLossPower(ose.getWindturbineId(), ose.getStopTime(), date);
|
|
|
|
+ ose.setLossPower(gc);
|
|
|
|
+ }
|
|
|
|
+ // 新增 shutdownevent2 实时
|
|
|
|
+ ProEconShutdownEvent2 ose2 = oldShutdownEvent2.get(status.getWindturbineId());
|
|
|
|
+ if (ose2 != null)
|
|
|
|
+ {
|
|
|
|
+ Double timehour=DateUtils.hoursDiff2(date,ose2.getStopTime());
|
|
|
|
+ Double gc = calcLossPower(ose.getWindturbineId(), ose2.getStopTime(), date);
|
|
|
|
+ ose2.setLossPower(gc);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void updateAndAddStatus( ProEconWindturbineStatus status) throws Exception {
|
|
|
|
+ status.setStartTime(date);
|
|
|
|
+
|
|
|
|
+ List<PointData> speedDataList1;
|
|
|
|
+ String type1;
|
|
|
|
+
|
|
|
|
+ if (windTurbines.get(status.getWindturbineId()).getWindpowerstationId().indexOf("GDC") >= 0)
|
|
|
|
+ {
|
|
|
|
+ String point=gzdpointMap.get(windTurbines.get(status.getWindturbineId()).getWindpowerstationId()).getCode();
|
|
|
|
+ speedDataList1 =edosUtil.getHistoryDatasSnap(point,status.getStopTime().getTime()/1000,status.getStartTime().getTime()/1000);
|
|
|
|
+ type1 = "GDC";
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ String point=speedpointMap.get(status.getWindturbineId()).getCode();
|
|
|
|
+ speedDataList1 =edosUtil.getHistoryDatasSnap(point,status.getStopTime().getTime()/1000,status.getStartTime().getTime()/1000);
|
|
|
|
+
|
|
|
|
+ type1 = "FDC";
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (speedDataList1 != null && speedDataList1.size() > 0)
|
|
|
|
+ {
|
|
|
|
+ status.setSpeed(speedDataList1.get(0).getPointValueInDouble());
|
|
|
|
+ DoubleSummaryStatistics summaryStatistics=speedDataList1.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
|
|
|
|
+ status.setAvgSpeed(summaryStatistics.getAverage());
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ status.setSpeed(0.0);
|
|
|
|
+ status.setAvgSpeed(0.0);
|
|
|
|
+ }
|
|
|
|
+ Double timehour=DateUtils.hoursDiff2(date,status.getStopTime());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ status.setStopHours(timehour);
|
|
|
|
+
|
|
|
|
+ ProEconShutdownEvent shutdwonEvent = null;
|
|
|
|
+ ProEconInterruption interrup = null;
|
|
|
|
+ // #region 新增 shutdownevent2 实时
|
|
|
|
+ ProEconShutdownEvent2 shutdwonEvent2 = null;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ProEconWindturbineStatus newStatusItem = buildWindturbineStatus(status.getWindturbineId(), date, shutdwonEvent, interrup, shutdwonEvent2);
|
|
|
|
+
|
|
|
|
+ proEconWindturbineStatusService.save(newStatusItem);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Integer oldStatus = (Integer)status.getSatusCode();
|
|
|
|
+ Integer currentStatus = this.status.get(status.getWindturbineId());
|
|
|
|
+ if (shutdwonEvent != null)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ if (currentStatus == 2 || currentStatus == 4)
|
|
|
|
+ {
|
|
|
|
+ if (oldStatus == 0 || oldStatus == 1 || oldStatus == 3)
|
|
|
|
+ {
|
|
|
|
+ proEconShutdownEventService.save(shutdwonEvent);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (interrup != null)
|
|
|
|
+ {
|
|
|
|
+ if (currentStatus == 3 && oldStatus != 3)
|
|
|
|
+ {
|
|
|
|
+ proEconInterruptionService.save(interrup);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 新增 shutdownevent2 实时
|
|
|
|
+ if (shutdwonEvent2 != null)
|
|
|
|
+ {
|
|
|
|
+ if (currentStatus == 2 || currentStatus == 4)
|
|
|
|
+ {
|
|
|
|
+ if (oldStatus == 0 || oldStatus == 1 || oldStatus == 3)
|
|
|
|
+ {
|
|
|
|
+ Date dtbegin = DateUtils.addMinutes(shutdwonEvent2.getStopTime(),-30);
|
|
|
|
+ Date dtend = shutdwonEvent2.getStopTime();
|
|
|
|
+ String windTurbineId = shutdwonEvent2.getWindturbineId();
|
|
|
|
+
|
|
|
|
+ Optional<ProEconShutdownEvent2> olditem=proEconShutdownEvent2Service.list().stream()
|
|
|
|
+ .filter(i->i.getWindturbineId().equals(windTurbineId)
|
|
|
|
+ && ( i.getStartTime().compareTo(dtbegin)==0 || i.getStartTime().after(dtbegin))
|
|
|
|
+ && (i.getStartTime().compareTo(dtend)==0 || i.getStartTime().before(dtend))
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ).sorted(Comparator.comparing(ProEconShutdownEvent2::getStartTime)).findFirst();
|
|
|
|
+
|
|
|
|
+ ProEconShutdownEvent2 temp=null;
|
|
|
|
+ if (!olditem.isPresent())
|
|
|
|
+ {
|
|
|
|
+ proEconShutdownEvent2Service.save(shutdwonEvent2);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ temp=olditem.get();
|
|
|
|
+ temp.setStartTime(null);
|
|
|
|
+ if (!oldShutdownEvent2.containsKey(temp.getWindturbineId()))
|
|
|
|
+ oldShutdownEvent2.put(temp.getWindturbineId(), temp);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (oldStatus == 2 || oldStatus == 4)
|
|
|
|
+ {
|
|
|
|
+ if (currentStatus == 0 || currentStatus == 1 || currentStatus == 3)
|
|
|
|
+ {
|
|
|
|
+ ProEconShutdownEvent ose = oldShutdownEvent.get(status.getWindturbineId());
|
|
|
|
+ if (ose != null)
|
|
|
|
+ {
|
|
|
|
+ ose.setStartTime(date);
|
|
|
|
+
|
|
|
|
+ timehour=DateUtils.hoursDiff2(date,ose.getStopTime());
|
|
|
|
+ ose.setStopHours(timehour);
|
|
|
|
+
|
|
|
|
+ if (!ose.getStoptypeId().equals("wh"))
|
|
|
|
+ {
|
|
|
|
+ String s =newMethod( status.getWindturbineId(), DateUtils.addMinutes(ose.getStopTime(),-5), date);
|
|
|
|
+ if (StringUtils.notEmp(s))
|
|
|
|
+ {
|
|
|
|
+ ose.setStoptypeId(s);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //Double gc = calcLossPower(ose.WINDTURBINEID, ose.STOPTIME.Value, ose.STARTTIME.Value, ose.STOPHOURS.Value, entities);
|
|
|
|
+ //ose.LOSSPOWER = gc;
|
|
|
|
+ }
|
|
|
|
+ // 新增 shutdownevent2 实时
|
|
|
|
+ ProEconShutdownEvent2 ose2 = oldShutdownEvent2.get(status.getWindturbineId());
|
|
|
|
+ if (ose2 != null)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ ose2.setStartTime(date);
|
|
|
|
+
|
|
|
|
+ timehour=DateUtils.hoursDiff2(date,ose.getStopTime());
|
|
|
|
+ ose2.setStopHours(timehour);
|
|
|
|
+
|
|
|
|
+ if (ose!=null && !ose.getStoptypeId().equals("wh"))
|
|
|
|
+ {
|
|
|
|
+ if (ose != null)
|
|
|
|
+ {
|
|
|
|
+ ose2.setStopTypeId(ose.getStoptypeId());
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ String s = newMethod( status.getWindturbineId(), DateUtils.addMinutes(ose2.getStopTime(),-5), date);
|
|
|
|
+ if (StringUtils.notEmp(s))
|
|
|
|
+ {
|
|
|
|
+ ose2.setStopTypeId(s);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (oldStatus == 3 && currentStatus != 3)
|
|
|
|
+ {
|
|
|
|
+ ProEconInterruption item = oldInterrup.get(status.getWindturbineId());
|
|
|
|
+ if (item != null)
|
|
|
|
+ {
|
|
|
|
+ item.setStartTime(date);
|
|
|
|
+
|
|
|
|
+ timehour=DateUtils.hoursDiff2(date,item.getStopTime());
|
|
|
|
+ item.setStopHours(timehour);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private Double calcLossPower(String windturbineId, Date startDate, Date endDate) throws Exception {
|
|
|
|
+ Double result = 0.0;
|
|
|
|
+
|
|
|
|
+ Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
|
|
|
|
+ Map<String, ProBasicEquipmentPoint> wtpointmap=wtpAimap.get(windturbineId);
|
|
|
|
+
|
|
|
|
+ Calendar c1=Calendar.getInstance();
|
|
|
|
+ c1.setTime(startDate);
|
|
|
|
+ Calendar c2=Calendar.getInstance();
|
|
|
|
+ c2.setTime(endDate);
|
|
|
|
+ //判定限电是否跨年
|
|
|
|
+ if(endDate.after(startDate) && c1.get(Calendar.YEAR)==c2.get(Calendar.YEAR))
|
|
|
|
+ {
|
|
|
|
+ //年故障损失电量
|
|
|
|
+ if(wtpointmap.containsKey(Contant.WTNGZSSDL) )
|
|
|
|
+ {
|
|
|
|
+ double beginvalue=0.0;
|
|
|
|
+ double endvalue=0.0;
|
|
|
|
+
|
|
|
|
+ String[] pointid=new String[1];
|
|
|
|
+ pointid[0]=wtpointmap.get(Contant.WTNGZSSDL).getCode();
|
|
|
|
+ DNAVal[] xdbegin=edosUtil.getHistMatrix(pointid,Integer.valueOf(String.valueOf(startDate.getTime()/1000)));
|
|
|
|
+ DNAVal[] xdend=edosUtil.getHistMatrix(pointid,Integer.valueOf(String.valueOf(endDate.getTime()/1000)));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(xdbegin.length==1 && xdend.length==1)
|
|
|
|
+ {
|
|
|
|
+ beginvalue=xdbegin[0].DValue;
|
|
|
|
+ endvalue=xdend[0].DValue;
|
|
|
|
+
|
|
|
|
+ if (endvalue > beginvalue) {
|
|
|
|
+ result =result+(endvalue - beginvalue);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }else
|
|
|
|
+ {
|
|
|
|
+ Calendar c=Calendar.getInstance();
|
|
|
|
+ c.setTime(DateUtils.truncDay(startDate));
|
|
|
|
+ c.add(Calendar.DAY_OF_MONTH,1);
|
|
|
|
+ //获得1月1日零点值
|
|
|
|
+ Date endtime=c.getTime();
|
|
|
|
+ //年故障损失电量
|
|
|
|
+ if(wtpointmap.containsKey(Contant.WTNGZSSDL) )
|
|
|
|
+ {
|
|
|
|
+ double beginvalue=0.0;
|
|
|
|
+ double endvalue=0.0;
|
|
|
|
+
|
|
|
|
+ String[] pointid=new String[1];
|
|
|
|
+ pointid[0]=wtpointmap.get(Contant.WTNGZSSDL).getCode();
|
|
|
|
+ DNAVal[] xdbegin=edosUtil.getHistMatrix(pointid,Integer.valueOf(String.valueOf(startDate.getTime()/1000)));
|
|
|
|
+ DNAVal[] xdend=edosUtil.getHistMatrix(pointid,Integer.valueOf(String.valueOf(endtime.getTime()/1000)));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(xdbegin.length==1 && xdend.length==1)
|
|
|
|
+ {
|
|
|
|
+ beginvalue=xdbegin[0].DValue;
|
|
|
|
+ endvalue=xdend[0].DValue;
|
|
|
|
+
|
|
|
|
+ if (endvalue > beginvalue) {
|
|
|
|
+ result =result+(endvalue - beginvalue);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //日故障损失电量
|
|
|
|
+ if(wtpointmap.containsKey(Contant.WTNGZSSDL) )
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ double endvalue=0.0;
|
|
|
|
+
|
|
|
|
+ String[] pointid=new String[1];
|
|
|
|
+ pointid[0]=wtpointmap.get(Contant.WTNGZSSDL).getCode();
|
|
|
|
+ DNAVal[] xdend=edosUtil.getHistMatrix(pointid,Integer.valueOf(String.valueOf(endDate.getTime()/1000)));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(xdend.length==1)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ endvalue=xdend[0].DValue;
|
|
|
|
+
|
|
|
|
+ if (endvalue > 0) {
|
|
|
|
+ result =result+endvalue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return result;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// private void buildActivePowerData(Date beginDate, String windturbineId, Double speed, List<Double> powers,ProEconActivePowerData data)
|
|
|
|
+// {
|
|
|
|
+//
|
|
|
|
+// data.setWindturbineId(windturbineId);
|
|
|
|
+//
|
|
|
|
+// DoubleSummaryStatistics summaryStatistics=powers.stream().mapToDouble(n -> n).summaryStatistics();
|
|
|
|
+// data.setPower(summaryStatistics.getAverage());
|
|
|
|
+// data.setSpeed(speed);
|
|
|
|
+// data.setFrequency(Double.valueOf(powers.size()));
|
|
|
|
+// data.setRecordDate(beginDate);
|
|
|
|
+// data.setModelId(windTurbines.get(windturbineId).getModelId());
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+//
|
|
|
|
+// //读取历史数据
|
|
|
|
+// public List<PointData> GetHisData(String szPoint, Date startTime, Date endTime) throws Exception {
|
|
|
|
+// List<PointData> result = edosUtil.getHistoryDatasSnap(szPoint, startTime.getTime()/1000, endTime.getTime()/1000);
|
|
|
|
+// if (result.size() == 0)
|
|
|
|
+// {
|
|
|
|
+//
|
|
|
|
+// PointData pa = new PointData();
|
|
|
|
+// pa.setPointValueInDouble(0.0);
|
|
|
|
+// result.add(pa);
|
|
|
|
+// }
|
|
|
|
+// return result;
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //private ProEconWindturbineStatus buildWindturbineStatus(String windturbineId, Date date, out ProEconShutdownEvent shutdwonEvent,
|
|
|
|
+ // out ProEconInterruption interrup, GdsjEntities entities)
|
|
|
|
+ //{
|
|
|
|
+ // shutdwonEvent = null;
|
|
|
|
+ // interrup = null;
|
|
|
|
+
|
|
|
|
+ // ProEconWindturbineStatus retValue = new ProEconWindturbineStatus();
|
|
|
|
+ // retValue.PROJECTID = windTurbines[windturbineId].PROJECTID;
|
|
|
|
+ // retValue.SATUSCODE = status[windturbineId];
|
|
|
|
+ // retValue.STATUSDESC = statusDescription[status[windturbineId]];
|
|
|
|
+ // retValue.STOPTIME = date;
|
|
|
|
+ // retValue.WINDPOWERSTATIONID = windTurbines[windturbineId].WINDPOWERSTATIONID;
|
|
|
|
+ // retValue.WINDTURBINEID = windturbineId;
|
|
|
|
+
|
|
|
|
+ // Integer currentStatus = status[windturbineId];
|
|
|
|
+ // if (currentStatus == 2 || currentStatus == 4)
|
|
|
|
+ // {
|
|
|
|
+ // shutdwonEvent = new ProEconShutdownEvent();
|
|
|
|
+ // shutdwonEvent.ID = Guid.NewGuid().ToString();
|
|
|
|
+ // shutdwonEvent.PROJECTID = retValue.PROJECTID;
|
|
|
|
+ // shutdwonEvent.STATUSCODE = currentStatus;
|
|
|
|
+ // shutdwonEvent.STOPTIME = date;
|
|
|
|
+ // shutdwonEvent.WINDPOWERSTATIONID = retValue.WINDPOWERSTATIONID;
|
|
|
|
+ // shutdwonEvent.WINDTURBINEID = windturbineId;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // if (currentStatus == 2)
|
|
|
|
+ // {
|
|
|
|
+ // var begin = date.AddMinutes(-5);
|
|
|
|
+ // var temp = entities.WARNINGRECORDS.Where(it => it.WARNINGTIME >= begin && it.WARNINGTIME <= date && it.WINDTURBINEID == windturbineId).FirstOrDefault();
|
|
|
|
+
|
|
|
|
+ // shutdwonEvent.STOPTYPEID = currentStatus == 2 ? "gzbmq" : "wh";
|
|
|
|
+ // if (temp != null)
|
|
|
|
+ // {
|
|
|
|
+ // var id = temp.WARNINGID;
|
|
|
|
+ // var tempitem = entities.WARNING.Where(it => it.ID == id).FirstOrDefault();
|
|
|
|
+ // if (tempitem != null)
|
|
|
|
+ // {
|
|
|
|
+ // shutdwonEvent.STOPTYPEID = tempitem.WARNINGCLASSIFYID;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // else
|
|
|
|
+ // {
|
|
|
|
+ // shutdwonEvent.STOPTYPEID = "wh";
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // retValue.SHUTDOWNEVENTID = shutdwonEvent.ID;
|
|
|
|
+ // }
|
|
|
|
+ // if (currentStatus == 3)
|
|
|
|
+ // {
|
|
|
|
+ // interrup = new ProEconInterruption();
|
|
|
|
+ // interrup.PROJECTID = retValue.PROJECTID;
|
|
|
|
+ // interrup.STOPTIME = date;
|
|
|
|
+ // interrup.WINDPOWERSTATIONID = retValue.WINDPOWERSTATIONID;
|
|
|
|
+ // interrup.WINDTURBINEID = windturbineId;
|
|
|
|
+ // }
|
|
|
|
+ // return retValue;
|
|
|
|
+ //}
|
|
|
|
+
|
|
|
|
+ // 新增 shutdownevent2 实时
|
|
|
|
+ private ProEconWindturbineStatus buildWindturbineStatus(String windturbineId, Date date, ProEconShutdownEvent shutdwonEvent,
|
|
|
|
+ ProEconInterruption interrup, ProEconShutdownEvent2 shutdwonEvent2)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ProEconWindturbineStatus retValue = new ProEconWindturbineStatus();
|
|
|
|
+
|
|
|
|
+ retValue.setProjectId(windTurbines.get(windturbineId).getProjectId());
|
|
|
|
+
|
|
|
|
+ retValue.setSatusCode(status.get(windturbineId));
|
|
|
|
+ retValue.setStatusDesc(statusDescription.get(status.get(windturbineId)));
|
|
|
|
+ retValue.setStopTime(date);
|
|
|
|
+ retValue.setWindpowerstationId(windTurbines.get(windturbineId).getWindpowerstationId());
|
|
|
|
+ retValue.setWindturbineId(windturbineId);
|
|
|
|
+
|
|
|
|
+ Integer currentStatus = status.get(windturbineId);
|
|
|
|
+ if (currentStatus == 2 || currentStatus == 4)
|
|
|
|
+ {
|
|
|
|
+ shutdwonEvent = new ProEconShutdownEvent();
|
|
|
|
+ shutdwonEvent.setId(StringUtils.getUUID());
|
|
|
|
+ shutdwonEvent.setProjectId(retValue.getProjectId());
|
|
|
|
+ shutdwonEvent.setStatusCode(currentStatus);
|
|
|
|
+ shutdwonEvent.setStopTime(date);
|
|
|
|
+ shutdwonEvent.setWindpowerstationId(retValue.getWindpowerstationId());
|
|
|
|
+ shutdwonEvent.setWindturbineId(windturbineId);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ shutdwonEvent2 = new ProEconShutdownEvent2();
|
|
|
|
+ shutdwonEvent2.setId(StringUtils.getUUID());
|
|
|
|
+ shutdwonEvent2.setProjectId(retValue.getProjectId());
|
|
|
|
+ shutdwonEvent2.setStatusCode(currentStatus);
|
|
|
|
+ shutdwonEvent2.setStopTime(date);
|
|
|
|
+ shutdwonEvent2.setWinpowerstationId(retValue.getWindpowerstationId());
|
|
|
|
+ shutdwonEvent2.setWindturbineId(windturbineId);
|
|
|
|
+
|
|
|
|
+ if (currentStatus == 2)
|
|
|
|
+ {
|
|
|
|
+ Date begin =DateUtils.addMinutes(date,-5);
|
|
|
|
+ Date end = DateUtils.addMinutes(date,5);
|
|
|
|
+ shutdwonEvent.setStoptypeId(currentStatus == 2 ? "gzbmq" : "wh");
|
|
|
|
+ shutdwonEvent2.setStopTypeId(currentStatus == 2 ? "gzbmq" : "wh");
|
|
|
|
+ //读取报警记录表前后五分钟数据,选取第一个报警报警类型
|
|
|
|
+ String s =newMethod( windturbineId, begin, end);
|
|
|
|
+ if (StringUtils.notEmp(s))
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ shutdwonEvent.setStoptypeId(s);
|
|
|
|
+ shutdwonEvent2.setStopTypeId(s);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ shutdwonEvent.setStoptypeId("wh");
|
|
|
|
+ shutdwonEvent2.setStopTypeId("wh");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ retValue.setShutdownEventId(shutdwonEvent.getId());
|
|
|
|
+ }
|
|
|
|
+ if (currentStatus == 3)
|
|
|
|
+ {
|
|
|
|
+ interrup = new ProEconInterruption();
|
|
|
|
+ interrup.setProjectId(retValue.getProjectId());
|
|
|
|
+ interrup.setStopTime(date);
|
|
|
|
+ interrup.setWindpowerstationId(retValue.getWindpowerstationId());
|
|
|
|
+ interrup.setWindturbineId(windturbineId);
|
|
|
|
+ }
|
|
|
|
+ return retValue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //TODO-SL
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 需要添加报警记录关联停机事件方法
|
|
|
|
+ * @param windturbineId
|
|
|
|
+ * @param begin
|
|
|
|
+ * @param end
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private static String newMethod( String windturbineId, Date begin, Date end)
|
|
|
|
+ {
|
|
|
|
+ String result = "";
|
|
|
|
+
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|