|
@@ -10,7 +10,6 @@ import com.jiayue.ipfcst.common.core.util.SunRiseSet;
|
|
|
import com.jiayue.ipfcst.common.data.abst.equipmentstatus.AbstractEquipmentStatusData;
|
|
|
import com.jiayue.ipfcst.common.data.constant.enums.ElectricFieldTypeEnum;
|
|
|
import com.jiayue.ipfcst.common.data.entity.*;
|
|
|
-import com.jiayue.ipfcst.common.data.repository.PowerLimitPlanSignRepository;
|
|
|
import com.jiayue.ipfcst.console.service.powerofreference.BasePowerOfReferenceCalculator;
|
|
|
import com.jiayue.ipfcst.console.service.powerofreference.iml.PowerOfReferenceCalculator1;
|
|
|
import com.jiayue.ipfcst.console.service.powerofreference.iml.PowerOfReferenceCalculator2;
|
|
@@ -22,7 +21,6 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.joda.time.DateTime;
|
|
|
import org.joda.time.LocalTime;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
import java.math.BigDecimal;
|
|
@@ -85,15 +83,11 @@ public class PowerStationDataPacker {
|
|
|
*/
|
|
|
private static final String YBJSF = "ybjsf";
|
|
|
|
|
|
- /**
|
|
|
- * 是否对实际功率进行考核验证 0 不验证 1 验证
|
|
|
- */
|
|
|
- private static final String AUDITREALPOWER = "auditRealPower";
|
|
|
|
|
|
/**
|
|
|
* 理论功率公式
|
|
|
*/
|
|
|
- private static final String LLGLGS ="kyglgs";
|
|
|
+ private static final String LLGLGS = "kyglgs";
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -117,7 +111,7 @@ public class PowerStationDataPacker {
|
|
|
/**
|
|
|
* 场站信息
|
|
|
*/
|
|
|
- private ElectricField electricField;
|
|
|
+ private final ElectricField electricField;
|
|
|
/**
|
|
|
* 测风/光法 的公式计算器
|
|
|
*/
|
|
@@ -126,17 +120,7 @@ public class PowerStationDataPacker {
|
|
|
/**
|
|
|
* 实际功率是否需要审核的标志 默认不审核
|
|
|
*/
|
|
|
- private Boolean auditRealPower = false;
|
|
|
-
|
|
|
- /**
|
|
|
- * 人工控制限电的标识
|
|
|
- * 0 以系统判断结果为准
|
|
|
- * 1 限电
|
|
|
- * 2 不限电
|
|
|
- * 现在由于页面展示的原因 仅开放两种状态 是否限电 1.限电 0.不限电
|
|
|
- * 没有以系统判断结果为准 在不限电的时候默认系统判断结果进行干预
|
|
|
- */
|
|
|
- private Integer rationingByManualControl = 0;
|
|
|
+ private static final Boolean AUDIT_REAL_POWER = false;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -151,74 +135,29 @@ public class PowerStationDataPacker {
|
|
|
/**
|
|
|
* 系统配置变量获取类
|
|
|
*/
|
|
|
- SysParameterService sysParameterService= SpringContextHolder.getBean(SysParameterService.class);
|
|
|
- /**
|
|
|
- * 用于从数据库内获取限电状态
|
|
|
- */
|
|
|
- PowerLimitPlanSignRepository powerLimitPlanSignRepository= SpringContextHolder.getBean(PowerLimitPlanSignRepository.class);
|
|
|
+ SysParameterService sysParameterService = SpringContextHolder.getBean(SysParameterService.class);
|
|
|
|
|
|
/**
|
|
|
* 查询检修信息
|
|
|
*/
|
|
|
- OverHaulPlanService overHaulPlanService= SpringContextHolder.getBean(OverHaulPlanService.class);
|
|
|
- /**
|
|
|
- * 查询场站的具体信息
|
|
|
- */
|
|
|
- ElectricFieldService electricFieldService= SpringContextHolder.getBean(ElectricFieldService.class);
|
|
|
+ OverHaulPlanService overHaulPlanService = SpringContextHolder.getBean(OverHaulPlanService.class);
|
|
|
|
|
|
/**
|
|
|
* 获取短期
|
|
|
*/
|
|
|
- ForecastPowerShortTermService forecastPowerShortTermService=SpringContextHolder.getBean(ForecastPowerShortTermService.class);
|
|
|
+ ForecastPowerShortTermService forecastPowerShortTermService = SpringContextHolder.getBean(ForecastPowerShortTermService.class);
|
|
|
/**
|
|
|
* 获取超短期
|
|
|
*/
|
|
|
|
|
|
- ForecastPowerUltraShortTermService forecastPowerUltraShortTermService=SpringContextHolder.getBean(ForecastPowerUltraShortTermService.class);
|
|
|
- /**
|
|
|
- * 风机信息的查询 方便推算样板机数据
|
|
|
- */
|
|
|
- protected WindTurbineInfoService windTurbineInfoService=SpringContextHolder.getBean(WindTurbineInfoService.class);
|
|
|
+ ForecastPowerUltraShortTermService forecastPowerUltraShortTermService = SpringContextHolder.getBean(ForecastPowerUltraShortTermService.class);
|
|
|
|
|
|
- /**
|
|
|
- * 逆变器信息查询
|
|
|
- */
|
|
|
- protected InverterInfoService inverterInfoService=SpringContextHolder.getBean(InverterInfoService.class);
|
|
|
|
|
|
/**
|
|
|
* redis 工具
|
|
|
*/
|
|
|
- private RedisUtils redisUtils=SpringContextHolder.getBean(RedisUtils.class);;
|
|
|
+ private final RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
|
|
|
|
|
|
- /**
|
|
|
- * 根据数据库的限电状态记录加载初始的
|
|
|
- * 当数据库里面没有记录时默认 0 不限电
|
|
|
- */
|
|
|
- public Integer getRationingByManualControl() {
|
|
|
- List<PowerLimitPlanSign> list = powerLimitPlanSignRepository.findAllByStationCode(electricField.getStationCode());
|
|
|
- if (list.size() > 0) {
|
|
|
- this.rationingByManualControl = list.get(list.size() - 1).getSign();
|
|
|
- } else {
|
|
|
- this.rationingByManualControl = 0;
|
|
|
- }
|
|
|
- return this.rationingByManualControl;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 对DashboardService 开放的手动控制限电的状态修改方法
|
|
|
- * 用于页面上修改后进行通知
|
|
|
- *
|
|
|
- * @param powerLimitPlanSign
|
|
|
- */
|
|
|
- public void setRationingByManualControl(PowerLimitPlanSign powerLimitPlanSign) {
|
|
|
- if (powerLimitPlanSign != null) {
|
|
|
- this.rationingByManualControl = powerLimitPlanSign.getSign();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public void setRationingByManualControl(Integer sign) {
|
|
|
- this.rationingByManualControl = sign;
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 对实际功率合理性进行审核 查看实际功率的合理性
|
|
@@ -228,7 +167,7 @@ public class PowerStationDataPacker {
|
|
|
*/
|
|
|
public BigDecimal realPowerRationalityAuditor(BigDecimal power) {
|
|
|
DateTime time = DateTime.now();
|
|
|
- if (electricField != null && electricField.getCapacity() != null && power.compareTo(electricField.getCapacity()) == 1) {
|
|
|
+ if (electricField != null && electricField.getCapacity() != null && power.compareTo(electricField.getCapacity()) > 0) {
|
|
|
//当实际功率超过场站的容量时 返回容量
|
|
|
power = electricField.getCapacity();
|
|
|
if (power.compareTo(BigDecimal.ZERO) < 0) {
|
|
@@ -286,7 +225,7 @@ public class PowerStationDataPacker {
|
|
|
if (realPower == null) {
|
|
|
return BigDecimal.valueOf(-99D);
|
|
|
}
|
|
|
- if (this.auditRealPower) {
|
|
|
+ if (AUDIT_REAL_POWER) {
|
|
|
return realPowerRationalityAuditor(realPower);
|
|
|
} else {
|
|
|
BigDecimal power = realPower;
|
|
@@ -333,9 +272,9 @@ public class PowerStationDataPacker {
|
|
|
*/
|
|
|
private void initReferenceCalculator() {
|
|
|
if ("1".equals(sysParameterService.getSysParameter(YBJSF, "1", electricField.getStationCode()))) {
|
|
|
- this.powerOfReferenceCalculatorBySample = new PowerOfReferenceCalculator1(windTurbineInfoService, inverterInfoService, electricFieldService.getOne(electricField.getStationCode())).init();
|
|
|
+ this.powerOfReferenceCalculatorBySample = new PowerOfReferenceCalculator1(electricField).init();
|
|
|
} else {
|
|
|
- this.powerOfReferenceCalculatorBySample = new PowerOfReferenceCalculator2(windTurbineInfoService, inverterInfoService, electricFieldService.getOne(electricField.getStationCode())).init();
|
|
|
+ this.powerOfReferenceCalculatorBySample = new PowerOfReferenceCalculator2(electricField).init();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -351,12 +290,12 @@ public class PowerStationDataPacker {
|
|
|
BigDecimal baseLinePower = electricField.getCapacity().multiply(new BigDecimal(sysParameterService.getSysParameter(SFPDXD, "1", electricField.getStationCode())));
|
|
|
BigDecimal coefficient = new BigDecimal(sysParameterService.getSysParameter(XDXS, "0.2", electricField.getStationCode())).add(BigDecimal.valueOf(1));
|
|
|
BigDecimal referencePower = this.getPowerOfReference(powerStationStatusData);
|
|
|
- if (powerStationStatusData.getRealValue().compareTo(baseLinePower) == -1) {
|
|
|
+ if (powerStationStatusData.getRealValue().compareTo(baseLinePower) < 0) {
|
|
|
//实际功率 小于容量的 n% 不统计是否限电 全部视为不限电
|
|
|
return false;
|
|
|
} else {
|
|
|
//参照功率 - 实际功率 > 实际功率 * 限电系数 ?? 大于就限电 小于就不限电
|
|
|
- return referencePower.compareTo(powerStationStatusData.getRealValue().multiply(coefficient)) == 1;
|
|
|
+ return referencePower.compareTo(powerStationStatusData.getRealValue().multiply(coefficient)) > 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -409,50 +348,49 @@ public class PowerStationDataPacker {
|
|
|
//设定并网设备数
|
|
|
powerStationStatusData.setOnGridNum(electricField.getGridCE());
|
|
|
//设定开机容量为装机容量
|
|
|
- powerStationStatusData.setOpenCapacity(electricField.getCapacity().subtract(overHaulPlanService.getOverhaulCapacity()));
|
|
|
+ powerStationStatusData.setOpenCapacity(electricField.getCapacity().subtract(overHaulPlanService.getOverhaulCapacityByStationCode(electricField.getStationCode())));
|
|
|
//设定场站状态
|
|
|
powerStationStatusData.setStatus(electricField.getElectricFieldTypeEnum().getCode());
|
|
|
//设定实际功率
|
|
|
powerStationStatusData.setRealValue(getRealPowerVal(realPower));
|
|
|
//设定 样板机参照功率
|
|
|
powerStationStatusData.setReferencePowerBySample(powerOfReferenceCalculatorBySample.getEstimatePower());
|
|
|
- if (powerStationStatusData.getReferencePowerBySample() == null || powerStationStatusData.getReferencePowerBySample().compareTo(powerStationStatusData.getRealValue()) == -1) {
|
|
|
+ if (powerStationStatusData.getReferencePowerBySample() == null || powerStationStatusData.getReferencePowerBySample().compareTo(powerStationStatusData.getRealValue()) < 0) {
|
|
|
log.warn("样板机法计算值小于实际功率异常,值为:" + powerStationStatusData.getReferencePowerBySample());
|
|
|
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, BigDecimal.ROUND_HALF_UP));
|
|
|
- } else if (powerStationStatusData.getReferencePowerBySample().compareTo(powerStationStatusData.getCapacity()) == 1) {
|
|
|
+ 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());
|
|
|
powerStationStatusData.setAbnormalOfSample(powerStationStatusData.getReferencePowerBySample());
|
|
|
powerStationStatusData.setReferencePowerBySample(powerStationStatusData.getCapacity());
|
|
|
}
|
|
|
- powerStationStatusData.setAblePowerBySample(powerOfReferenceCalculatorBySample.getEstimatePower().multiply(getOpenRatio()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ powerStationStatusData.setAblePowerBySample(powerOfReferenceCalculatorBySample.getEstimatePower().multiply(getOpenRatio()).setScale(2, RoundingMode.HALF_UP));
|
|
|
if (powerStationStatusData.getAblePowerBySample().compareTo(powerStationStatusData.getRealValue()) < 0) {
|
|
|
powerStationStatusData.setAblePowerBySample(powerStationStatusData.getReferencePowerBySample());
|
|
|
}
|
|
|
//设定 测风光法参照功率
|
|
|
if (this.calculatorOfMeasuring != null) {
|
|
|
- powerStationStatusData.setReferencePowerByMeasuring(this.calculatorOfMeasuring.getData().setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ powerStationStatusData.setReferencePowerByMeasuring(this.calculatorOfMeasuring.getData().setScale(2, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
- if (powerStationStatusData.getReferencePowerByMeasuring() == null || powerStationStatusData.getReferencePowerByMeasuring().compareTo(powerStationStatusData.getRealValue()) == -1) {
|
|
|
+ if (powerStationStatusData.getReferencePowerByMeasuring() == null || powerStationStatusData.getReferencePowerByMeasuring().compareTo(powerStationStatusData.getRealValue()) < 0) {
|
|
|
log.warn("测风光法计算值小于实际功率异常,值为:" + powerStationStatusData.getReferencePowerByMeasuring());
|
|
|
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, BigDecimal.ROUND_HALF_UP));
|
|
|
- } else if (powerStationStatusData.getReferencePowerByMeasuring().compareTo(powerStationStatusData.getCapacity()) == 1) {
|
|
|
+ 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());
|
|
|
powerStationStatusData.setAbnormalOfMeasuring(powerStationStatusData.getReferencePowerByMeasuring());
|
|
|
powerStationStatusData.setReferencePowerByMeasuring(powerStationStatusData.getCapacity());
|
|
|
}
|
|
|
- powerStationStatusData.setAblePowerByMeasuring(powerStationStatusData.getReferencePowerByMeasuring().multiply(getOpenRatio()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ powerStationStatusData.setAblePowerByMeasuring(powerStationStatusData.getReferencePowerByMeasuring().multiply(getOpenRatio()).setScale(2, RoundingMode.HALF_UP));
|
|
|
if (powerStationStatusData.getAblePowerByMeasuring().compareTo(powerStationStatusData.getRealValue()) < 0) {
|
|
|
powerStationStatusData.setAblePowerByMeasuring(powerStationStatusData.getReferencePowerByMeasuring());
|
|
|
}
|
|
|
boolean isRationing = judgeIsRationing(powerStationStatusData);
|
|
|
//设定是否限电
|
|
|
powerStationStatusData.setIsRationingByAutoControl(isRationing);
|
|
|
- //设定手动限电的状态
|
|
|
- powerStationStatusData.setIsRationingByManualControl(getRationingByManualControl());
|
|
|
+
|
|
|
//设定理论和可用
|
|
|
- if (getRationingByManualControl() == 1 || (isRationing && getRationingByManualControl() == 0)) {
|
|
|
+ if (isRationing) {
|
|
|
//限电情况下 平均功率和实际功率取大者 乘倍率
|
|
|
switch (sysParameterService.getSysParameter("kyglqz", "1", electricField.getStationCode())) {
|
|
|
case "2":
|
|
@@ -464,21 +402,21 @@ public class PowerStationDataPacker {
|
|
|
default: {
|
|
|
BigDecimal avgPower = getForecastPowerAvg();
|
|
|
BigDecimal randomNum = getRandomNum(new BigDecimal(sysParameterService.getSysParameter(KYGLJSMIN, "1", electricField.getStationCode())), new BigDecimal(sysParameterService.getSysParameter(KYGLJSMAX, "1.02", electricField.getStationCode())));
|
|
|
- if (avgPower.compareTo(powerStationStatusData.getRealValue()) == 1) {
|
|
|
- powerStationStatusData.setAbleValue(avgPower.multiply(randomNum).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ if (avgPower.compareTo(powerStationStatusData.getRealValue()) > 0) {
|
|
|
+ powerStationStatusData.setAbleValue(avgPower.multiply(randomNum).setScale(2, RoundingMode.HALF_UP));
|
|
|
} else {
|
|
|
- powerStationStatusData.setAbleValue(powerStationStatusData.getRealValue().multiply(randomNum).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ powerStationStatusData.setAbleValue(powerStationStatusData.getRealValue().multiply(randomNum).setScale(2, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- } else if ((!isRationing && getRationingByManualControl() == 0)) {
|
|
|
+ } else {
|
|
|
//不限电 实际功率,理论功率,可用功率 理论=k*可用=k*实际
|
|
|
powerStationStatusData.setAbleValue(powerStationStatusData.getRealValue().multiply(BigDecimal.ONE.add(getMagnificationK())).setScale(2, RoundingMode.HALF_DOWN));
|
|
|
}
|
|
|
|
|
|
if (powerStationStatusData.getOpenCapacity().compareTo(new BigDecimal(0)) != 0) {
|
|
|
//设置理论功率
|
|
|
- powerStationStatusData.setTheoryValue(powerStationStatusData.getAbleValue().multiply(BigDecimal.ONE.add(getMagnificationK())).add(overHaulPlanService.getOverhaulCapacity().multiply(powerStationStatusData.getRealValue().divide(powerStationStatusData.getOpenCapacity(), 2))).setScale(2, RoundingMode.HALF_DOWN));
|
|
|
+ powerStationStatusData.setTheoryValue(powerStationStatusData.getAbleValue().multiply(BigDecimal.ONE.add(getMagnificationK())).add(overHaulPlanService.getOverhaulCapacityByStationCode(electricField.getStationCode()).multiply(powerStationStatusData.getRealValue().divide(powerStationStatusData.getOpenCapacity(), RoundingMode.CEILING))).setScale(2, RoundingMode.HALF_DOWN));
|
|
|
} else {
|
|
|
powerStationStatusData.setTheoryValue(new BigDecimal(0));
|
|
|
}
|
|
@@ -522,7 +460,7 @@ public class PowerStationDataPacker {
|
|
|
* 获取当前时间开机容量比 即开机容量和装机容量的比值
|
|
|
*/
|
|
|
public BigDecimal getOpenRatio() {
|
|
|
- return BigDecimal.ONE.subtract(overHaulPlanService.getOverhaulCapacity().divide(electricField.getCapacity(), 2, RoundingMode.HALF_DOWN));
|
|
|
+ return BigDecimal.ONE.subtract(overHaulPlanService.getOverhaulCapacityByStationCode(electricField.getStationCode()).divide(electricField.getCapacity(), 2, RoundingMode.HALF_DOWN));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -577,18 +515,18 @@ public class PowerStationDataPacker {
|
|
|
/**
|
|
|
* 正式的
|
|
|
*/
|
|
|
- public String formula ;
|
|
|
+ public String formula;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 用于替换公式的值
|
|
|
*/
|
|
|
- public Map<String,Object> dataMap=new HashMap<>();
|
|
|
+ public Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
|
|
/**
|
|
|
* 原始数据池
|
|
|
*/
|
|
|
- Map<String, String> oDataMap=new HashMap<>();
|
|
|
+ Map<String, String> oDataMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -605,56 +543,55 @@ public class PowerStationDataPacker {
|
|
|
/**
|
|
|
* 初始化
|
|
|
*//* 光伏组件效率*(1-0.003*(光伏组件温度-25))*math.pow(0.992,3)*总辐射*光伏组件总面积/1000000*0.79*/
|
|
|
- public void init() throws Exception {
|
|
|
- AviatorEvaluator.setOption(Options.ALWAYS_PARSE_FLOATING_POINT_NUMBER_INTO_DECIMAL, true);
|
|
|
- this.formula= sysParameterService.getSysParameter(LLGLGS, "", electricField.getStationCode());
|
|
|
- try {
|
|
|
- this.compiledExp = AviatorEvaluator.compile(formula);
|
|
|
- } catch (ExpressionSyntaxErrorException e) {
|
|
|
- log.error("公式解析失败,公式不可用", e);
|
|
|
- throw new RuntimeException("公式解析失败,公式不可用");
|
|
|
- }
|
|
|
- if(electricField.getElectricFieldTypeEnum()==ElectricFieldTypeEnum.E1){
|
|
|
- WeatherStationInfoService weatherStationInfoService=SpringContextHolder.getBean(WeatherStationInfoService.class);
|
|
|
- List<WeatherStationInfo> l = weatherStationInfoService.getAll();
|
|
|
- if(l.size()>=1){
|
|
|
- this.equipmentNo=l.get(0).getId();
|
|
|
- }else {
|
|
|
- throw new Exception("系统缺少气象站信息");
|
|
|
- }
|
|
|
- }else{
|
|
|
- WindTowerInfoService windTowerInfoService=SpringContextHolder.getBean(WindTowerInfoService.class);
|
|
|
- List<WindTowerInfo> l = windTowerInfoService.getAll();
|
|
|
- if(l.size()>=1){
|
|
|
- this.equipmentNo=l.get(0).getId();
|
|
|
- }else {
|
|
|
- throw new Exception("系统缺少测风塔信息");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public void updateDates(){
|
|
|
- if(electricField.getElectricFieldTypeEnum()==ElectricFieldTypeEnum.E1){
|
|
|
- //光伏
|
|
|
- oDataMap = redisUtils.hgetall("qxz-" + electricField.getStationCode() + "-" + equipmentNo);
|
|
|
- if(oDataMap.containsKey("cellT")){
|
|
|
- dataMap.put("光伏组件温度",new BigDecimal(oDataMap.get("cellT")));
|
|
|
- }
|
|
|
- if(oDataMap.containsKey("globalR")){
|
|
|
- dataMap.put("总辐射",new BigDecimal(oDataMap.get("globalR")));
|
|
|
- }
|
|
|
- }else{
|
|
|
- oDataMap = redisUtils.hgetall("cft-" + electricField.getStationCode() + "-" + equipmentNo);
|
|
|
- if(oDataMap.containsKey("wsInstHubHeight")){
|
|
|
- dataMap.put("轮毂风速",new BigDecimal(oDataMap.get("wsInstHubHeight")));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- BigDecimal getData(){
|
|
|
- return new BigDecimal(compiledExp.execute(dataMap)+"");
|
|
|
+ public void init() throws Exception {
|
|
|
+ AviatorEvaluator.setOption(Options.ALWAYS_PARSE_FLOATING_POINT_NUMBER_INTO_DECIMAL, true);
|
|
|
+ this.formula = sysParameterService.getSysParameter(LLGLGS, "", electricField.getStationCode());
|
|
|
+ try {
|
|
|
+ this.compiledExp = AviatorEvaluator.compile(formula);
|
|
|
+ } catch (ExpressionSyntaxErrorException e) {
|
|
|
+ log.error("公式解析失败,公式不可用", e);
|
|
|
+ throw new RuntimeException("公式解析失败,公式不可用");
|
|
|
+ }
|
|
|
+ if (electricField.getElectricFieldTypeEnum() == ElectricFieldTypeEnum.E1) {
|
|
|
+ WeatherStationInfoService weatherStationInfoService = SpringContextHolder.getBean(WeatherStationInfoService.class);
|
|
|
+ List<WeatherStationInfo> l = weatherStationInfoService.getAll();
|
|
|
+ if (l.size() >= 1) {
|
|
|
+ this.equipmentNo = l.get(0).getId();
|
|
|
+ } else {
|
|
|
+ throw new Exception("系统缺少气象站信息");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ WindTowerInfoService windTowerInfoService = SpringContextHolder.getBean(WindTowerInfoService.class);
|
|
|
+ List<WindTowerInfo> l = windTowerInfoService.getAll();
|
|
|
+ if (l.size() >= 1) {
|
|
|
+ this.equipmentNo = l.get(0).getId();
|
|
|
+ } else {
|
|
|
+ throw new Exception("系统缺少测风塔信息");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void updateDates() {
|
|
|
+ if (electricField.getElectricFieldTypeEnum() == ElectricFieldTypeEnum.E1) {
|
|
|
+ //光伏
|
|
|
+ oDataMap = redisUtils.hgetall("qxz-" + electricField.getStationCode() + "-" + equipmentNo);
|
|
|
+ if (oDataMap.containsKey("cellT")) {
|
|
|
+ dataMap.put("光伏组件温度", new BigDecimal(oDataMap.get("cellT")));
|
|
|
+ }
|
|
|
+ if (oDataMap.containsKey("globalR")) {
|
|
|
+ dataMap.put("总辐射", new BigDecimal(oDataMap.get("globalR")));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ oDataMap = redisUtils.hgetall("cft-" + electricField.getStationCode() + "-" + equipmentNo);
|
|
|
+ if (oDataMap.containsKey("wsInstHubHeight")) {
|
|
|
+ dataMap.put("轮毂风速", new BigDecimal(oDataMap.get("wsInstHubHeight")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ BigDecimal getData() {
|
|
|
+ return new BigDecimal(compiledExp.execute(dataMap) + "");
|
|
|
}
|
|
|
}
|
|
|
}
|