|
@@ -31,6 +31,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
@Resource
|
|
|
private IStateAiService stateAiService;
|
|
|
@Resource
|
|
|
+ private RedisTemplate redisTemplate;
|
|
|
+ @Resource
|
|
|
private IEquipmentModelService equipmentModelService;
|
|
|
|
|
|
@Override
|
|
@@ -348,34 +350,109 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
//redisTemplate.opsForHash().put("state_point",key,value);
|
|
|
|
|
|
}
|
|
|
- public void calcStationXd(){
|
|
|
- DateTime time = DateUtil.date();
|
|
|
- DateTime time5 = DateUtil.offsetMinute(DateUtil.date(), -5);
|
|
|
+ public void calcStationXd(boolean priorRation){
|
|
|
//限电状态
|
|
|
- PointInfo pi = new PointInfo();
|
|
|
- pi.setUniformCode("AGC009");
|
|
|
- pi.setInstitutionType("booster");
|
|
|
- List<PointInfo> entity = pointService.getByEntity(pi);
|
|
|
- Map<String, PointInfo> collect = entity.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
- String keys = pointInfos2Keys(entity);
|
|
|
+ PointInfo piAgc = new PointInfo();
|
|
|
+ //AGC
|
|
|
+ piAgc.setUniformCode("AGC002");
|
|
|
+ piAgc.setInstitutionType("booster");
|
|
|
+ List<PointInfo> entityAgc = pointService.getByEntity(piAgc);
|
|
|
+ Map<String, PointInfo> collectAgc = entityAgc.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
+ String keysAgc = pointInfos2Keys(entityAgc);
|
|
|
+
|
|
|
+ //出线
|
|
|
+ PointInfo piCx = new PointInfo();
|
|
|
+ piCx.setUniformCode("AGC001");
|
|
|
+ piCx.setInstitutionType("booster");
|
|
|
+ List<PointInfo> entityCx = pointService.getByEntity(piCx);
|
|
|
+ Map<String, PointInfo> collectCx = entityCx.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
+ String keysCx = pointInfos2Keys(entityCx);
|
|
|
+
|
|
|
+ Map<String, PointData> statAgc = adapter.getLatest(goldenUri(), keysAgc);
|
|
|
+ Map<String, PointData> statCx = adapter.getLatest(goldenUri(), keysCx);
|
|
|
+ DateTime time5 = DateUtil.offsetMinute(DateUtil.date(), -5);
|
|
|
+ List<DoubleStatData> statAgc5 = adapter.getHistoryStat(goldenUri(), keysAgc, time5.getTime(), DateUtil.date().getTime());
|
|
|
+ List<DoubleStatData> statCx5 = adapter.getHistoryStat(goldenUri(), keysCx, time5.getTime(), DateUtil.date().getTime());
|
|
|
|
|
|
- //自算功率
|
|
|
- PointInfo piZg = new PointInfo();
|
|
|
- piZg.setUniformCode("AGC010");
|
|
|
- piZg.setInstitutionType("booster");
|
|
|
- List<PointInfo> entityZg = pointService.getByEntity(piZg);
|
|
|
- Map<String, PointInfo> collectZg = entityZg.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
- String keysZg = pointInfos2Keys(entityZg);
|
|
|
+ //AI066
|
|
|
+ for (PointInfo info : entityAgc) {
|
|
|
+ //如果场站限电状态为0
|
|
|
+ /*if (priorRation) {
|
|
|
+ if (zsgl5 >= sub.getCapacity() * 0.4) {
|
|
|
+ if (zsgl / agc > 1.15) {
|
|
|
+ b = true;
|
|
|
+ }
|
|
|
+ if (agc5 <= cxgl5) {
|
|
|
+ b = true;
|
|
|
+ }
|
|
|
+ if (zsgl > agc && agc5 - cxgl5 < 4) {
|
|
|
+ b = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
|
|
|
- Map<String, PointData> latest = adapter.getLatest(taosGoldenUriTest(), keys);
|
|
|
- List<DoubleStatData> statZg = adapter.getHistoryStat(taosGoldenUriTest(), keysZg, time5.getTime(), time.getTime());
|
|
|
+ if (zsgl5 >= sub.getCapacity() * 0.4) {
|
|
|
+ if (zsgl / agc >= 1.2 && agc - cxgl <= 2) {
|
|
|
+ b = true;
|
|
|
+ }
|
|
|
+ if (agc5 <= cxgl5) {
|
|
|
+ b = true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (k) {
|
|
|
+ if (agc5 <= cxgl5) {
|
|
|
+ b = true;
|
|
|
+ }
|
|
|
+ if (zsgl / agc >= 1.1 && agc5 - cxgl5 <= 2) {
|
|
|
+ b = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- for (PointInfo info : entity) {
|
|
|
- PointData xdzt = latest.get(info.getPointKey());
|
|
|
- //如果场站限电状态为0
|
|
|
- if(xdzt==null||xdzt.getDoubleValue()==0.0){
|
|
|
|
|
|
+ public void calcNhglZs(boolean priorRation){
|
|
|
+ //拟合功率(自算)
|
|
|
+ //实时风速
|
|
|
+ PointInfo piFs = new PointInfo();
|
|
|
+ piFs.setUniformCode("AI066");
|
|
|
+ piFs.setInstitutionType("turbine");
|
|
|
+ List<PointInfo> entityFs = pointService.getByEntity(piFs);
|
|
|
+ Map<String, PointInfo> collectFs = entityFs.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
+ String keysFs = pointInfos2Keys(entityFs);
|
|
|
+ //设备拟合功率(自算)
|
|
|
+ PointInfo piFjzsgl = new PointInfo();
|
|
|
+ piFjzsgl.setUniformCode("ZSGL");
|
|
|
+ piFjzsgl.setInstitutionType("turbine");
|
|
|
+ List<PointInfo> entityFjzsgl = pointService.getByEntity(piFjzsgl);
|
|
|
+ Map<String, PointInfo> collectFjzsgl = entityFjzsgl.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
+ String keysFjzsgl = pointInfos2Keys(entityFjzsgl);
|
|
|
+ //场站自算功率
|
|
|
+ PointInfo piCzzsgl = new PointInfo();
|
|
|
+ piCzzsgl.setUniformCode("AGC010");
|
|
|
+ piCzzsgl.setInstitutionType("booster");
|
|
|
+ List<PointInfo> entityCzzsgl = pointService.getByEntity(piCzzsgl);
|
|
|
+ Map<String, PointInfo> collectCzzsgl = entityCzzsgl.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
+ String keysCzzsgl = pointInfos2Keys(entityCzzsgl);
|
|
|
+
|
|
|
+ DateTime time = DateUtil.beginOfMinute(DateUtil.date());
|
|
|
+ DateTime time5 = DateUtil.offsetMinute(time, -5);
|
|
|
+ List<DoubleStatData> statFs5;
|
|
|
+ PointData avg;
|
|
|
+ for (PointInfo info : entityFs) {
|
|
|
+ statFs5 = adapter.getHistoryStat(goldenUri(), keysFs, time5.getTime(), time.getTime());
|
|
|
+ if(!statFs5.isEmpty()){
|
|
|
+ avg = statFs5.get(0).getAvg();
|
|
|
+ avg.setTs(time.getTime());
|
|
|
+ avg.setTagName(info.getPointKey());
|
|
|
+ adapter.writeHistory(taosUri(), avg);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public URI goldenUri(){
|
|
|
+ return URI.create("http://172.16.12.103:8011/ts");
|
|
|
+ }
|
|
|
}
|