Ver código fonte

实际功率加日志

xiuwei 3 anos atrás
pai
commit
4204ca6c59

+ 15 - 15
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/PowerStationDataPacker.java

@@ -195,22 +195,22 @@ public class PowerStationDataPacker {
     String lgjsfs = sysParameterService.getSysParameter(LGJSFS, "0", electricField.getStationCode());
     switch (lgjsfs) {
       case "1":
-        log.info("使用样板机方式计算参考值");
+        log.info("{}使用样板机方式计算参考值",electricField.getName());
         if (powerStationStatusData.getReferencePowerBySample() != null) {
           return powerStationStatusData.getReferencePowerBySample().multiply(getOpenRatio());
         } else {
-          log.info("样板机方式计算参考值为空返回倍率计算方式");
+          log.info("{}样板机方式计算参考值为空返回倍率计算方式",electricField.getName());
         }
       case "2":
-        log.info("使用测风/光法方式计算参考值");
+        log.info("{}使用测风/光法方式计算参考值",electricField.getName());
         if (powerStationStatusData.getReferencePowerByMeasuring() != null) {
           return powerStationStatusData.getReferencePowerByMeasuring().multiply(getOpenRatio());
         } else {
-          log.info("测风/光法方式计算参考值为空返回倍率计算方式");
+          log.info("{}测风/光法方式计算参考值为空返回倍率计算方式",electricField.getName());
         }
       default:
     }
-    log.info("不判断限电,直接判断不限电");
+    log.info("{}不判断限电,直接判断不限电",electricField.getName());
     return BigDecimal.valueOf(-99);
   }
 
@@ -357,11 +357,11 @@ public class PowerStationDataPacker {
       //设定 样板机参照功率
       powerStationStatusData.setReferencePowerBySample(powerOfReferenceCalculatorBySample.getEstimatePower());
       if (powerStationStatusData.getReferencePowerBySample() == null || powerStationStatusData.getReferencePowerBySample().compareTo(powerStationStatusData.getRealValue()) < 0) {
-        log.warn("样板机法计算值小于实际功率异常,值为:" + powerStationStatusData.getReferencePowerBySample());
+        log.warn("{}样板机法计算值小于实际功率异常,值为:" + powerStationStatusData.getReferencePowerBySample(),electricField.getName());
         powerStationStatusData.setAbnormalOfSample(powerStationStatusData.getReferencePowerBySample());
         powerStationStatusData.setReferencePowerBySample(((electricField.getCapacity().subtract(powerStationStatusData.getRealValue())).multiply(BigDecimal.valueOf(random.nextFloat())).multiply(BigDecimal.valueOf(0.001))).add(powerStationStatusData.getRealValue()).setScale(2, RoundingMode.HALF_UP));
       } else if (powerStationStatusData.getReferencePowerBySample().compareTo(powerStationStatusData.getCapacity()) > 0) {
-        log.warn("样板机法计算值超装机容量异常,值为:" + powerStationStatusData.getReferencePowerBySample());
+        log.warn("{}样板机法计算值超装机容量异常,值为:" + powerStationStatusData.getReferencePowerBySample(),electricField.getName());
         powerStationStatusData.setAbnormalOfSample(powerStationStatusData.getReferencePowerBySample());
         powerStationStatusData.setReferencePowerBySample(powerStationStatusData.getCapacity());
       }
@@ -374,11 +374,11 @@ public class PowerStationDataPacker {
         powerStationStatusData.setReferencePowerByMeasuring(this.calculatorOfMeasuring.getData().setScale(2, RoundingMode.HALF_UP));
       }
       if (powerStationStatusData.getReferencePowerByMeasuring() == null || powerStationStatusData.getReferencePowerByMeasuring().compareTo(powerStationStatusData.getRealValue()) < 0) {
-        log.warn("测风光法计算值小于实际功率异常,值为:" + powerStationStatusData.getReferencePowerByMeasuring());
+        log.warn("{}测风光法计算值小于实际功率异常,值为:" + powerStationStatusData.getReferencePowerByMeasuring(),electricField.getName());
         powerStationStatusData.setAbnormalOfMeasuring(powerStationStatusData.getReferencePowerByMeasuring());
         powerStationStatusData.setReferencePowerByMeasuring(((electricField.getCapacity().subtract(powerStationStatusData.getRealValue())).multiply(BigDecimal.valueOf(random.nextFloat())).multiply(BigDecimal.valueOf(0.001))).add(powerStationStatusData.getRealValue()).setScale(2, RoundingMode.HALF_UP));
       } else if (powerStationStatusData.getReferencePowerByMeasuring().compareTo(powerStationStatusData.getCapacity()) > 0) {
-        log.warn("测风光法计算值超装机容量异常,值为:" + powerStationStatusData.getReferencePowerByMeasuring());
+        log.warn("{}测风光法计算值超装机容量异常,值为:" + powerStationStatusData.getReferencePowerByMeasuring(),electricField.getName());
         powerStationStatusData.setAbnormalOfMeasuring(powerStationStatusData.getReferencePowerByMeasuring());
         powerStationStatusData.setReferencePowerByMeasuring(powerStationStatusData.getCapacity());
       }
@@ -426,8 +426,8 @@ public class PowerStationDataPacker {
       //设置站外受阻
       powerStationStatusData.setOffSiteObstructed(powerStationStatusData.getAbleValue().subtract(powerStationStatusData.getRealValue()));
     } catch (Exception e) {
-      log.error("组装场站状态数据时发生异常", e);
-      throw new RuntimeException("组装场站状态数据时发生异常");
+      log.error("{}组装场站状态数据时发生异常",electricField.getName(), e);
+      throw new RuntimeException(electricField.getName()+"组装场站状态数据时发生异常");
     }
 
     if (powerStationStatusData.getAbleValue().compareTo(BigDecimal.valueOf(-99)) == 0) {
@@ -550,8 +550,8 @@ public class PowerStationDataPacker {
       try {
         this.compiledExp = AviatorEvaluator.compile(formula);
       } catch (ExpressionSyntaxErrorException e) {
-        log.error("公式解析失败,公式不可用", e);
-        throw new RuntimeException("公式解析失败,公式不可用");
+        log.error("{}公式解析失败,公式不可用",electricField.getName(), e);
+        throw new RuntimeException(electricField.getName()+"公式解析失败,公式不可用");
       }
       if (electricField.getElectricFieldTypeEnum() == ElectricFieldTypeEnum.E1) {
         WeatherStationInfoService weatherStationInfoService = SpringContextHolder.getBean(WeatherStationInfoService.class);
@@ -559,7 +559,7 @@ public class PowerStationDataPacker {
         if (l.size() >= 1) {
           this.equipmentNo = l.get(0).getId();
         } else {
-          throw new Exception("系统缺少气象站信息");
+          throw new Exception(electricField.getName()+"系统缺少气象站信息");
         }
       } else {
         WindTowerInfoService windTowerInfoService = SpringContextHolder.getBean(WindTowerInfoService.class);
@@ -567,7 +567,7 @@ public class PowerStationDataPacker {
         if (l.size() >= 1) {
           this.equipmentNo = l.get(0).getId();
         } else {
-          throw new Exception("系统缺少测风塔信息");
+          throw new Exception(electricField.getName()+"系统缺少测风塔信息");
         }
       }
     }

+ 2 - 2
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/powerofreference/iml/PowerOfReferenceCalculator1.java

@@ -57,7 +57,7 @@ public class PowerOfReferenceCalculator1 extends BasePowerOfReferenceCalculator
         for (SampleEquipment e : samples) {
           ratio = e.updatePower().getSamplePowerGenerationRatio();
           if (ratio.compareTo(BigDecimal.ONE) > 0) {
-            log.warn("样板机" + e.equipmentId + "发电量超装");
+            log.warn("{}样板机" + e.equipmentId + "发电量超装",electricField.getName());
           }
           if (ratio.compareTo(BigDecimal.ZERO) > 0) {
             avgRatio = avgRatio.add(ratio);
@@ -70,7 +70,7 @@ public class PowerOfReferenceCalculator1 extends BasePowerOfReferenceCalculator
       avgRatio = avgRatio.divide(BigDecimal.valueOf(samples.size()), 10, RoundingMode.HALF_UP).multiply(stationTotalCapacity).setScale(2, RoundingMode.HALF_UP);
     } catch (Exception e) {
       e.printStackTrace();
-      log.error("计算样板机法理论功率数据时发生了异常" + e);
+      log.error("{}计算样板机法理论功率数据时发生了异常" ,electricField.getName(), e);
     }
     return avgRatio;
   }

+ 43 - 0
ipfcst-console/velocity.log

@@ -361,3 +361,46 @@
 2021-10-25 17:01:15,285 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/CDQ_USE_F.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
 2021-10-25 17:01:20,046 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/NBQ.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
 2021-10-25 17:01:20,063 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/NBQ.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:13:06,285 - Log4JLogChute initialized using file 'velocity.log'
+2021-10-26 09:13:06,285 - Initializing Velocity, Calling init()...
+2021-10-26 09:13:06,285 - Starting Apache Velocity v1.7 (compiled: 2010-11-19 12:14:37)
+2021-10-26 09:13:06,285 - Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
+2021-10-26 09:13:06,285 - Trying to use logger class org.apache.velocity.runtime.log.AvalonLogChute
+2021-10-26 09:13:06,285 - Target log system for org.apache.velocity.runtime.log.AvalonLogChute is not available (java.lang.NoClassDefFoundError: org/apache/log/format/Formatter).  Falling back to next log system...
+2021-10-26 09:13:06,285 - Trying to use logger class org.apache.velocity.runtime.log.Log4JLogChute
+2021-10-26 09:13:06,285 - Using logger class org.apache.velocity.runtime.log.Log4JLogChute
+2021-10-26 09:13:06,291 - ResourceLoader instantiated: org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:13:06,292 - Do unicode file recognition:  false
+2021-10-26 09:13:06,292 - FileResourceLoader : adding path ''
+2021-10-26 09:13:06,304 - ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl) with class java.util.Collections$SynchronizedMap cache map.
+2021-10-26 09:13:06,306 - Loaded System Directive: org.apache.velocity.runtime.directive.Stop
+2021-10-26 09:13:06,307 - Loaded System Directive: org.apache.velocity.runtime.directive.Define
+2021-10-26 09:13:06,308 - Loaded System Directive: org.apache.velocity.runtime.directive.Break
+2021-10-26 09:13:06,309 - Loaded System Directive: org.apache.velocity.runtime.directive.Evaluate
+2021-10-26 09:13:06,309 - Loaded System Directive: org.apache.velocity.runtime.directive.Literal
+2021-10-26 09:13:06,311 - Loaded System Directive: org.apache.velocity.runtime.directive.Macro
+2021-10-26 09:13:06,312 - Loaded System Directive: org.apache.velocity.runtime.directive.Parse
+2021-10-26 09:13:06,314 - Loaded System Directive: org.apache.velocity.runtime.directive.Include
+2021-10-26 09:13:06,315 - Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
+2021-10-26 09:13:06,340 - Created '20' parsers.
+2021-10-26 09:13:06,349 - Velocimacro : "velocimacro.library" is not set.  Trying default library: VM_global_library.vm
+2021-10-26 09:13:06,349 - Velocimacro : Default library not found.
+2021-10-26 09:13:06,349 - Velocimacro : allowInline = true : VMs can be defined inline in templates
+2021-10-26 09:13:06,349 - Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
+2021-10-26 09:13:06,349 - Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
+2021-10-26 09:13:06,349 - Velocimacro : autoload off : VM system will not automatically reload global library macros
+2021-10-26 09:13:10,277 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/CDQ_F.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:13:11,361 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/CDQ_F.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:13:15,170 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/THEROY.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:13:15,275 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/THEROY.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:13:15,275 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/CDQ_USE_F.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:13:15,461 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/CDQ_USE_F.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:13:20,136 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/NBQ.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:13:23,567 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/NBQ.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:13:30,122 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/QXZ.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:13:30,531 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/QXZ.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:14:10,065 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/CDQ_F.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:14:10,073 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/CDQ_F.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:14:15,098 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/THEROY.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:14:15,214 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/CDQ_USE_F.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
+2021-10-26 09:14:15,222 - ResourceManager : found D:\codebase\focus\ipfcst-console\target\test-classes/vms/E63/CDQ_USE_F.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader