|
@@ -1,6 +1,7 @@
|
|
|
package com.gyee.frame.service.websocket;
|
|
|
|
|
|
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import com.gyee.frame.common.spring.Constant;
|
|
|
import com.gyee.frame.common.spring.InitialRunner;
|
|
|
import com.gyee.frame.model.auto.*;
|
|
@@ -10,6 +11,11 @@ import com.gyee.frame.service.WindTurbineTestingPointAiService;
|
|
|
import com.gyee.frame.service.WindTurbineTestingPointDiService;
|
|
|
import com.gyee.frame.service.WindturbineinfodayService;
|
|
|
import com.gyee.frame.util.*;
|
|
|
+
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+
|
|
|
+import org.apache.commons.compress.utils.Lists;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -1135,6 +1141,92 @@ public class WtInfoPushService {
|
|
|
return vos;
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
-
|
|
|
+ public List<Object> findInverterDI(String id) throws Exception {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<Object> findInverterPowerCurve(String id) throws Exception {
|
|
|
+ List<Object> list = Lists.newArrayList();
|
|
|
+ Date now = new Date();
|
|
|
+ Date date = DateUtil.beginOfDay(now);
|
|
|
+ String pointid = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, "AI130").getId();
|
|
|
+ while (date.before(now)) {
|
|
|
+ Date begin = DateUtils.addMinutes(date, -30);
|
|
|
+ List<PointData> histStat = realApiUtil.getHistStat(pointid, begin.getTime() / 1000, date.getTime() / 1000, 1L, 30L * 60, 0);
|
|
|
+ Double val = 0D;
|
|
|
+ if (histStat != null && !histStat.isEmpty() && histStat.get(0) != null) {
|
|
|
+ val = histStat.get(0).getPointValueInDouble();
|
|
|
+ val = MathUtil.twoBit(val);
|
|
|
+ }
|
|
|
+ list.add(val);
|
|
|
+ date = DateUtils.addMinutes(date, 30);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<Object> findInverterInfo(String id) throws Exception {
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ if (StringUtils.notEmp(id)) {
|
|
|
+ if (InitialRunner.wtmap.containsKey(id)) {
|
|
|
+ Windturbine wt = InitialRunner.wtmap.get(id);
|
|
|
+ map.put("model", wt.getModelid());
|
|
|
+ map.put("wpid", wt.getWindpowerstationid());
|
|
|
+ map.put("pjid", wt.getProjectid());
|
|
|
+ map.put("lnid", wt.getLineid());
|
|
|
+ map.put("code", wt.getCode());
|
|
|
+ Line ln = InitialRunner.lnmap.get(wt.getLineid());
|
|
|
+ map.put("lnname", ln.getName());
|
|
|
+ List<String> zbls = new ArrayList<>();
|
|
|
+ String[] codeName[] = {
|
|
|
+ {"AIG061", "交流电压","V"},
|
|
|
+ {"AIG081", "直流电压","V"},
|
|
|
+ {"AIG060", "交流电流","A"},
|
|
|
+ {"AIG078", "直流电流","A"},
|
|
|
+ {"AIG073", "电网频率","Hz"},
|
|
|
+ {"AI130", "功率","W"},
|
|
|
+ {"AIG104", "功率因数",""},
|
|
|
+ {"RFDL", "日发电量","kwh"},//TODO 疑似 各厂发电量单位不同意
|
|
|
+ {"YFDL", "月发电量","kwh"},
|
|
|
+ {"NFDL", "年发电量","kwh"},
|
|
|
+ {"AIG064", "累计发电量","kwh"},
|
|
|
+ {"AIG071", "逆变器温度","℃"},
|
|
|
+ {"AIG072", "效率",""},
|
|
|
+ {"eyht", "累计二氧化碳减排量","kg"}
|
|
|
+ };
|
|
|
+ // 遍历定义码,获取测点Id集合
|
|
|
+ Map<String, String> pointUniformMap = Maps.newHashMap();
|
|
|
+ for (String[] str1 : codeName) {
|
|
|
+ String pointid = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, str1[0]).getId();
|
|
|
+ zbls.add(pointid);
|
|
|
+ pointUniformMap.put(pointid, str1[0]);
|
|
|
+ }
|
|
|
+ // 获取测点值,与定义码绑定
|
|
|
+ List<PointData> zblist = realApiUtil.getRealData(zbls);
|
|
|
+ Map<String, Object> uniformValueMap = Maps.newHashMap();
|
|
|
+ for (PointData p : zblist) {
|
|
|
+ String ednaId = p.getEdnaId();
|
|
|
+ Double val = MathUtil.twoBit(p.getPointValueInDouble());
|
|
|
+ String uniformCode = pointUniformMap.get(ednaId);
|
|
|
+ uniformValueMap.put(uniformCode, val);
|
|
|
+ }
|
|
|
+ // 遍历定义码,添加测点值、单位、名称
|
|
|
+ List<Object> list = Lists.newArrayList();
|
|
|
+ for (String[] str1 : codeName) {
|
|
|
+ list.add(buildResult(str1[0], str1[1], uniformValueMap.get(str1[0]), str1[2]));
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Object> buildResult(String uniCode, String name, Object value, String unit) {
|
|
|
+ Map<String, Object> map = Maps.newHashMap();
|
|
|
+ map.put("uniCode", uniCode);
|
|
|
+ map.put("name", name);
|
|
|
+ map.put("value", value);
|
|
|
+ map.put("unit", unit);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
|
|
|
+}
|