Browse Source

1分钟平均指标计算

xushili 1 year ago
parent
commit
4a0c06bf6a
20 changed files with 91 additions and 121 deletions
  1. 1 1
      common/data/src/main/java/com/gyee/gaia/common/data/alarm/FaultInfo.java
  2. 20 20
      common/data/src/main/java/com/gyee/gaia/common/data/point/TestingPoint.java
  3. 11 11
      common/data/src/main/java/com/gyee/gaia/common/data/point/UniformCode.java
  4. 1 1
      common/data/src/main/java/com/gyee/gaia/common/data/timeseries/BooleanTsData.java
  5. 15 15
      common/data/src/main/java/com/gyee/gaia/common/data/windturbine/Booststation.java
  6. 1 1
      electricity/meter/src/main/java/com/gyee/gaia/meter/entity/MeterInfoBottomcode.java
  7. 4 5
      electricity/meter/src/main/java/com/gyee/gaia/meter/entity/MeterInfoCalculating.java
  8. 19 19
      electricity/meter/src/main/java/com/gyee/gaia/meter/util/AlarmScript.java
  9. 5 5
      electricity/meter/src/main/java/com/gyee/gaia/meter/util/TestScriptShell.java
  10. 2 6
      electricity/meter/src/main/resources/application.properties
  11. 1 0
      metrics/HELP.md
  12. 2 2
      metrics/src/main/java/com/gyee/gaia/metrics/cache/InfoCache.java
  13. 0 1
      metrics/src/main/java/com/gyee/gaia/metrics/dao/repsoitory/TsPointRepository.java
  14. 1 1
      metrics/src/main/java/com/gyee/gaia/metrics/services/BasicInformationService.java
  15. 3 16
      state/cause/README.md
  16. 2 2
      state/cause/src/main/java/com/gyee/gaia/cause/config/AppConfig.java
  17. 0 12
      state/wind/src/main/resources/mappers-postgresql/TestTb.xml
  18. 1 1
      timeseries/dao-interface/src/main/java/com/gyee/gaia/dao/windturbine/BooststationMapper.java
  19. 1 1
      timeseries/dao-sql/src/main/java/com/gyee/gaia/dao/sql/Windturbine/BooststationServiceImpl.java
  20. 1 1
      timeseries/dao-sql/src/main/java/com/gyee/gaia/dao/sql/Windturbine/IBooststationService.java

+ 1 - 1
common/data/src/main/java/com/gyee/gaia/common/data/alarm/FaultInfo.java

@@ -75,7 +75,7 @@ public class FaultInfo implements Serializable {
     }
 
     public String getCategoryName() {
-        if(category1==null) return "未知";
+        if (category1 == null) return "未知";
         switch (category1) {
             case "FJ":
                 return "风机";

+ 20 - 20
common/data/src/main/java/com/gyee/gaia/common/data/point/TestingPoint.java

@@ -6,7 +6,7 @@ import java.io.Serializable;
 
 /**
  * <p>
- * 
+ *
  * </p>
  *
  * @author gfhd
@@ -200,24 +200,24 @@ public class TestingPoint implements Serializable {
     @Override
     public String toString() {
         return "TestingPoint{" +
-            "id = " + id +
-            ", code = " + code +
-            ", name = " + name +
-            ", model = " + model +
-            ", typeId = " + typeId +
-            ", originalUniformCode = " + originalUniformCode +
-            ", uniformCode = " + uniformCode +
-            ", ucv1 = " + ucv1 +
-            ", ucv2 = " + ucv2 +
-            ", ucv3 = " + ucv3 +
-            ", thingId = " + thingId +
-            ", thingType = " + thingType +
-            ", dataType = " + dataType +
-            ", stationId = " + stationId +
-            ", logicalUnitId = " + logicalUnitId +
-            ", isDisplay = " + isDisplay +
-            ", spare = " + spare +
-            ", rate = " + rate +
-        "}";
+                "id = " + id +
+                ", code = " + code +
+                ", name = " + name +
+                ", model = " + model +
+                ", typeId = " + typeId +
+                ", originalUniformCode = " + originalUniformCode +
+                ", uniformCode = " + uniformCode +
+                ", ucv1 = " + ucv1 +
+                ", ucv2 = " + ucv2 +
+                ", ucv3 = " + ucv3 +
+                ", thingId = " + thingId +
+                ", thingType = " + thingType +
+                ", dataType = " + dataType +
+                ", stationId = " + stationId +
+                ", logicalUnitId = " + logicalUnitId +
+                ", isDisplay = " + isDisplay +
+                ", spare = " + spare +
+                ", rate = " + rate +
+                "}";
     }
 }

+ 11 - 11
common/data/src/main/java/com/gyee/gaia/common/data/point/UniformCode.java

@@ -6,7 +6,7 @@ import java.io.Serializable;
 
 /**
  * <p>
- * 统一编码表			设备类型:风电/光伏	测点类型:遥测/遥信/计算	
+ * 统一编码表			设备类型:风电/光伏	测点类型:遥测/遥信/计算
  * </p>
  *
  * @author gfhd
@@ -137,15 +137,15 @@ public class UniformCode implements Serializable {
     @Override
     public String toString() {
         return "UniformCode{" +
-            "id = " + id +
-            ", nemCode = " + nemCode +
-            ", description = " + description +
-            ", equipmentType = " + equipmentType +
-            ", pointType = " + pointType +
-            ", spare1 = " + spare1 +
-            ", spare2 = " + spare2 +
-            ", spare3 = " + spare3 +
-            ", spare4 = " + spare4 +
-        "}";
+                "id = " + id +
+                ", nemCode = " + nemCode +
+                ", description = " + description +
+                ", equipmentType = " + equipmentType +
+                ", pointType = " + pointType +
+                ", spare1 = " + spare1 +
+                ", spare2 = " + spare2 +
+                ", spare3 = " + spare3 +
+                ", spare4 = " + spare4 +
+                "}";
     }
 }

+ 1 - 1
common/data/src/main/java/com/gyee/gaia/common/data/timeseries/BooleanTsData.java

@@ -18,7 +18,7 @@ public class BooleanTsData extends BasicTsData {
 
     @Override
     public double getValue() {
-        return actualValue?1:0;
+        return actualValue ? 1 : 0;
     }
 }
 

+ 15 - 15
common/data/src/main/java/com/gyee/gaia/common/data/windturbine/Booststation.java

@@ -6,7 +6,7 @@ import java.io.Serializable;
 
 /**
  * <p>
- * 
+ *
  * </p>
  *
  * @author gfhd
@@ -150,19 +150,19 @@ public class Booststation implements Serializable {
     @Override
     public String toString() {
         return "Booststation{" +
-            "id = " + id +
-            ", code = " + code +
-            ", name = " + name +
-            ", aname = " + aname +
-            ", stationid = " + stationid +
-            ", projects = " + projects +
-            ", template = " + template +
-            ", capacity = " + capacity +
-            ", capacityunit = " + capacityunit +
-            ", quantity = " + quantity +
-            ", model = " + model +
-            ", ordernum = " + ordernum +
-            ", type = " + type +
-        "}";
+                "id = " + id +
+                ", code = " + code +
+                ", name = " + name +
+                ", aname = " + aname +
+                ", stationid = " + stationid +
+                ", projects = " + projects +
+                ", template = " + template +
+                ", capacity = " + capacity +
+                ", capacityunit = " + capacityunit +
+                ", quantity = " + quantity +
+                ", model = " + model +
+                ", ordernum = " + ordernum +
+                ", type = " + type +
+                "}";
     }
 }

+ 1 - 1
electricity/meter/src/main/java/com/gyee/gaia/meter/entity/MeterInfoBottomcode.java

@@ -85,7 +85,7 @@ public class MeterInfoBottomcode extends Model<MeterInfoBottomcode> implements S
     private String remark;
 
     /**
-     *场站
+     * 场站
      */
     private String windpowerstationId;
 

+ 4 - 5
electricity/meter/src/main/java/com/gyee/gaia/meter/entity/MeterInfoCalculating.java

@@ -12,7 +12,7 @@ import java.time.LocalDateTime;
 
 /**
  * <p>
- * 计算日电量
+ * 线路日发电量表
  * </p>
  */
 @TableName("pro_meter_calculating")
@@ -28,12 +28,12 @@ public class MeterInfoCalculating extends Model<MeterInfoCalculating> implements
     private Integer id;
 
     /**
-     * 场站id
+     * 线路编码;线路编码
      */
     private String windpowerstationId;
 
     /**
-     * 名称
+     * 线路名称;线路名称
      */
     private String name;
 
@@ -43,7 +43,6 @@ public class MeterInfoCalculating extends Model<MeterInfoCalculating> implements
     private LocalDateTime date;
 
 
-
     /**
      * 日发电量;日发电量,单位kwh
      */
@@ -75,7 +74,7 @@ public class MeterInfoCalculating extends Model<MeterInfoCalculating> implements
     private String remark;
 
     /**
-     * 计算点code
+     * 计算点凑得
      */
     private String code;
 

+ 19 - 19
electricity/meter/src/main/java/com/gyee/gaia/meter/util/AlarmScript.java

@@ -17,23 +17,23 @@ public class AlarmScript extends Script {
      * 数据有变化就报警
      * @return
      */
-//    public boolean IsChanged() {
-//        long entityId = (long)getBinding().getVariable(ScriptShell.entityIdName);
-//        String variable = (String)getBinding().getVariable(ScriptShell.variableName);
-//        TsData currentData = (TsData)getBinding().getVariable(ScriptShell.tsDataName);
-//        TsData preData = ScriptShell.getPreTsData(entityId,variable);
-//        if (preData == null) {
-//            return  true;   //如果没有前值,直接触发报警?
-//        }
-//        if (preData.getTs() >= currentData.getTs()) {
-//            return false;   //过期的数据,不触发报警
-//        }
-//        if (preData.getValue().equals(currentData.getValue())) {
-//            return false;
-//        } else {
-//            return true;    //当前值与前值不一样,触发报警
-//        }
-//
-//    }
-//
+    //    public boolean IsChanged() {
+    //        long entityId = (long)getBinding().getVariable(ScriptShell.entityIdName);
+    //        String variable = (String)getBinding().getVariable(ScriptShell.variableName);
+    //        TsData currentData = (TsData)getBinding().getVariable(ScriptShell.tsDataName);
+    //        TsData preData = ScriptShell.getPreTsData(entityId,variable);
+    //        if (preData == null) {
+    //            return  true;   //如果没有前值,直接触发报警?
+    //        }
+    //        if (preData.getTs() >= currentData.getTs()) {
+    //            return false;   //过期的数据,不触发报警
+    //        }
+    //        if (preData.getValue().equals(currentData.getValue())) {
+    //            return false;
+    //        } else {
+    //            return true;    //当前值与前值不一样,触发报警
+    //        }
+    //
+    //    }
+    //
 }

+ 5 - 5
electricity/meter/src/main/java/com/gyee/gaia/meter/util/TestScriptShell.java

@@ -1,5 +1,6 @@
 package com.gyee.gaia.meter.util;
 
+import com.gyee.gaia.meter.entity.MeterPoint;
 import groovy.lang.Binding;
 import groovy.lang.GroovyShell;
 import groovy.lang.Script;
@@ -8,7 +9,6 @@ import org.codehaus.groovy.control.CompilerConfiguration;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
-import com.gyee.gaia.meter.entity.MeterPoint;
 
 public class TestScriptShell {
 
@@ -83,13 +83,13 @@ public class TestScriptShell {
         row.put("ai2", 2.1);
         row.put("di1", false);
 
-//        DoubleTsData tsd = new DoubleTsData(1,(short)1,335.98);
-//        row.put("AI128", tsd);
+        //        DoubleTsData tsd = new DoubleTsData(1,(short)1,335.98);
+        //        row.put("AI128", tsd);
 
         //double a = Math.max()
 
-//        Object obj = parseExpr("AI128",row);
-//        System.out.println(obj);
+        //        Object obj = parseExpr("AI128",row);
+        //        System.out.println(obj);
         Object obj1 = parseExpr("Math.max(ai1, ai2)", row);
         System.out.println(obj1);
         Object obj2 = parseExpr("ai1 > ai2 && di1", row);

+ 2 - 6
electricity/meter/src/main/resources/application.properties

@@ -1,16 +1,12 @@
 ##需要动态配置的属性##
-
 #动态配置适配器的地址
 #adapter.url=http://192.168.10.18:8011/ts
 #adapter.url=http://192.168.10.18:8013/ts
 adapter.url=http://192.168.1.67:8011/ts
-
 #动态配置开始日期
-start.time=2023-02-01
+start.time=2023-04-01
 #动态配置结束日期
-end.time=2023-03-01
-
+end.time=2023-04-30
 meter.stations=MHS_FDC,NSS_FDC
-
 test.abcd=123456
 

+ 1 - 0
metrics/HELP.md

@@ -1,5 +1,6 @@
 # 指标计算服务
 
 ### 状态转换率计算服务
+
 用于计算风机状态转换率,以及提供数据查询接口
 

+ 2 - 2
metrics/src/main/java/com/gyee/gaia/metrics/cache/InfoCache.java

@@ -1,6 +1,5 @@
 package com.gyee.gaia.metrics.cache;
 
-import com.gyee.gaia.metrics.modles.TagInfo;
 import com.gyee.gaia.metrics.dao.entity.TsPointEntity;
 import com.gyee.gaia.metrics.dao.entity.WindturbineEntity;
 import com.gyee.gaia.metrics.dao.repsoitory.TsPointRepository;
@@ -8,6 +7,7 @@ import com.gyee.gaia.metrics.dao.repsoitory.WindturbineRepository;
 import com.gyee.gaia.metrics.manager.FileManager;
 import com.gyee.gaia.metrics.modles.BoostStation;
 import com.gyee.gaia.metrics.modles.ConversionRateWindTurbineInfo;
+import com.gyee.gaia.metrics.modles.TagInfo;
 import com.gyee.gaia.metrics.targets.UniformCode;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
@@ -45,7 +45,7 @@ public class InfoCache {
     }
 
     public InfoCache(TsPointRepository tsPointRepository, WindturbineRepository windturbineRepository
-    , FileManager fileManager, @Value("${no-maintain-model:}") String noMaintainModel) {
+            , FileManager fileManager, @Value("${no-maintain-model:}") String noMaintainModel) {
         this.windturbineRepository = windturbineRepository;
         this.tsPointRepository = tsPointRepository;
         this.fileManager = fileManager;

+ 0 - 1
metrics/src/main/java/com/gyee/gaia/metrics/dao/repsoitory/TsPointRepository.java

@@ -1,7 +1,6 @@
 package com.gyee.gaia.metrics.dao.repsoitory;
 
 import com.gyee.gaia.metrics.dao.entity.TsPointEntity;
-import org.springframework.cache.annotation.CacheConfig;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

+ 1 - 1
metrics/src/main/java/com/gyee/gaia/metrics/services/BasicInformationService.java

@@ -1,11 +1,11 @@
 package com.gyee.gaia.metrics.services;
 
-import com.gyee.gaia.metrics.modles.TagInfo;
 import com.gyee.gaia.metrics.cache.InfoCache;
 import com.gyee.gaia.metrics.feigns.IDataAdapter;
 import com.gyee.gaia.metrics.modles.BoostStation;
 import com.gyee.gaia.metrics.modles.ConversionRateWindTurbineInfo;
 import com.gyee.gaia.metrics.modles.PointData;
+import com.gyee.gaia.metrics.modles.TagInfo;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.ApplicationArguments;
 import org.springframework.boot.ApplicationRunner;

+ 3 - 16
state/cause/README.md

@@ -1,21 +1,8 @@
 ### cause 分析原因,故障损失,计划检修损失,受累损失,限电损失,性能损失等
 
-状态为:
-    并网--是否限电--风速小于11并且桨叶角度大于2;风速大于11并且有功功率小于满发功率减100
-    待机--
-        是否限停--
-            有故障--故障
-            无故障--有功设定小于出线功率;有功设定小于应发的85% 并且 出线功率大于有功设定94%;有功设定小于应发的70% 并且 出线功率大于有功设定80% 并且 当前场站限电台数大于等于3--限停
-        待机
-    维护--
-        有故障--故障
-        无故障--计划检修
-    故障--小于?(3)分钟故障忽略
-        是否受累--全站故障或者离线
-        故障
-    离线--
-        是否受累--全站故障或者离线
-        故障
+状态为: 并网--是否限电--风速小于11并且桨叶角度大于2;风速大于11并且有功功率小于满发功率减100 待机-- 是否限停-- 有故障--故障 无故障--有功设定小于出线功率;有功设定小于应发的85% 并且
+出线功率大于有功设定94%;有功设定小于应发的70% 并且 出线功率大于有功设定80% 并且 当前场站限电台数大于等于3--限停 待机 维护-- 有故障--故障 无故障--计划检修 故障--小于?(3)分钟故障忽略
+是否受累--全站故障或者离线 故障 离线-- 是否受累--全站故障或者离线 故障
 
 青山华创风机在停机的状态下应该算故障损失
 

+ 2 - 2
state/cause/src/main/java/com/gyee/gaia/cause/config/AppConfig.java

@@ -24,9 +24,9 @@ public class AppConfig {
     private Map<String, Long> longTime;
 
     public Map<String, Long> getLongTime() {
-        if(longTime==null){
+        if (longTime == null) {
             longTime = new HashMap<>();
-            time.forEach((k,v)->{
+            time.forEach((k, v) -> {
                 longTime.put(k, (v * 1000L));
             });
         }

+ 0 - 12
state/wind/src/main/resources/mappers-postgresql/TestTb.xml

@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.gyee.gaia.state.wind.mapper.TestTbMapper">
-
-
-    <select id="getAll" parameterType="java.util.Map" resultType="com.gyee.gaia.wind.entity.TestTb">
-        select *
-        from testtb a
-    </select>
-
-
-</mapper>

+ 1 - 1
timeseries/dao-interface/src/main/java/com/gyee/gaia/dao/windturbine/BooststationMapper.java

@@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
 
 /**
  * <p>
- *  Mapper 接口
+ * Mapper 接口
  * </p>
  *
  * @author gfhd

+ 1 - 1
timeseries/dao-sql/src/main/java/com/gyee/gaia/dao/sql/Windturbine/BooststationServiceImpl.java

@@ -7,7 +7,7 @@ import org.springframework.stereotype.Service;
 
 /**
  * <p>
- *  服务实现类
+ * 服务实现类
  * </p>
  *
  * @author gfhd

+ 1 - 1
timeseries/dao-sql/src/main/java/com/gyee/gaia/dao/sql/Windturbine/IBooststationService.java

@@ -5,7 +5,7 @@ import com.gyee.gaia.common.data.windturbine.Booststation;
 
 /**
  * <p>
- *  服务类
+ * 服务类
  * </p>
  *
  * @author gfhd