Commit e79709ef authored by ZWT's avatar ZWT

feat(能源管理系统): 间开优化定时任务

1.开发间开优化长期间开优化定时任务,完成并网流程绿电消纳优先策略;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent b6eb6ea2
......@@ -105,7 +105,7 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
for (SpaceInstitutionDetailEnt detail : detailEntList) {
String detailId = detail.getId();
String lineId = detail.getLineId();
Integer startInterval = detail.getStartInterval();
Integer startInterval = 0;
//创建记录
String longPeriodId = this.createOptimizeLongPeriod(longPeriodList, detailId, lineId, executionCycleForMonth, optimizeDeadline);
switch (detail.getGridTypeKey()) {
......@@ -183,6 +183,9 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
isFirstWellhead = true;
totalOperatingPower.add(serviceRating);
} else {
//累加
totalOperatingPower = totalOperatingPower.add(serviceRating);
startInterval = startInterval + detail.getStartInterval();
isFirstWellhead = false;
}
for (int d = 0, durationSize = durationConfigList.size(); d < durationSize; d++) {
......@@ -258,9 +261,6 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
if (endTimeOptimize.compareTo(endTime) < 0) {
between = ~between + 1;
}
//累加
totalOperatingPower = totalOperatingPower.add(serviceRating);
startInterval = startInterval + startInterval;
} else {
//无法优化
}
......@@ -299,6 +299,7 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
int lowWellheadListSize = lowWellheadList.size();
//光伏出力峰值<任何一口井的运行功率:消峰平谷策略
if (size == lowWellheadListSize) {
//---------------------------------井口优化---------------------------------
//通过线路ID和月份获取市电峰谷策略明细配置
List<GetBasePriceStrategyDetailOutput> strategyDetailList = ServiceUtil.getStrategyDetailList(context,
GetBasePriceStrategyDetailInput.builder()
......@@ -310,8 +311,93 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
//没有配置,不优化
continue;
}
//---------------------------------井口优化---------------------------------
//获取第一段谷电阶段的开始时间为第一口井的开井时间
Optional<GetBasePriceStrategyDetailOutput> low = strategyDetailList.stream()
.filter(s -> !StringUtils.isAnyBlank(s.getEndTime(), s.getStartTime()) && StringUtils.equals("LOW", s.getPeriodTypeKey()))
.findFirst();
if (!low.isPresent()) {
//没有谷电,不优化
continue;
}
GetBasePriceStrategyDetailOutput strategyDetailOutput = low.get();
//第一口井启动时间
DateTime firstStartTime = DateUtil.parse(strategyDetailOutput.getStartTime() + BusinessConstant.INITIALIZATION_SECOND, BusinessConstant.TIME_FORMAT);
DateTime firstEndTime = DateUtil.parse(strategyDetailOutput.getEndTime() + BusinessConstant.INITIALIZATION_SECOND, BusinessConstant.TIME_FORMAT);
//判断是否第一口井
boolean isFirstWellhead;
//优化时间间隔
int between = 0;
for (int w = 0, wellheadSize = wellheadViewList.size(); w < wellheadSize; w++) {
SpaceInstitutionWellheadView wellhead = wellheadViewList.get(w);
String wellheadId = wellhead.getWellheadId();
String recordId = this.createOptimizeLongWellhead(longWellheadList, longPeriodId, wellheadId, wellhead.getWellNumber());
List<SpaceInstitutionDurationEnt> durationConfigList = durationMap.get(wellhead);
if (CollUtil.isEmpty(durationConfigList)) {
//没有设置时间段,无法优化
continue;
}
if (w == 0) {
//第一个井口
isFirstWellhead = true;
} else {
//计算启动间隔
startInterval = startInterval + detail.getStartInterval();
isFirstWellhead = false;
}
for (int d = 0, durationSize = durationConfigList.size(); d < durationSize; d++) {
SpaceInstitutionDurationEnt duration = durationConfigList.get(d);
String openWellTime = duration.getOpenWellTime();
DateTime startTime = DateUtil.parse(openWellTime + BusinessConstant.INITIALIZATION_SECOND, BusinessConstant.TIME_FORMAT);
DateTime endTime = DateUtil.parse(duration.getCloseWellTime() + BusinessConstant.INITIALIZATION_SECOND, BusinessConstant.TIME_FORMAT);
//第一次启动
if (d == 0) {
//第一口井的启动时间
if (isFirstWellhead) {
//计算优化后的时间差优化后的第一口井开井时间-优化前第一次开井时间
//取时间间隔(分钟)
between = (int) firstEndTime.between(endTime, DateUnit.MINUTE);
if (firstEndTime.compareTo(endTime) < 0) {
between = ~between + 1;
}
this.createOptimizeLongDuration(longDurationList, duration, longPeriodId, recordId, wellheadId, null,
strategyDetailOutput.getStartTime(), strategyDetailOutput.getEndTime()
);
}//其它井口的第一次启动时间
else {
//其它井启动时间:第一口井启动时间+启动间隔
DateTime startTimeOffset = firstStartTime.offset(DateField.MINUTE, startInterval);
DateTime endTimeOffset = firstEndTime.offset(DateField.MINUTE, startInterval);
//取时间间隔(分钟)
between = (int) firstEndTime.between(endTime, DateUnit.MINUTE);
if (firstEndTime.compareTo(endTime) < 0) {
between = ~between + 1;
}
this.createOptimizeLongDuration(longDurationList, duration, longPeriodId, recordId, wellheadId, null,
startTimeOffset.toString(BusinessConstant.MINUTES_FORMAT), endTimeOffset.toString(BusinessConstant.MINUTES_FORMAT)
);
}
} else {
DateTime offset = startTime.offset(DateField.MINUTE, between);
if (offset.compareTo(dateFlag) > 0) {
//如果时间超过当天,舍弃
continue;
}
DateTime endDate = DateUtil.parse(duration.getCloseWellTime() + BusinessConstant.INITIALIZATION_SECOND, BusinessConstant.TIME_FORMAT)
.offset(DateField.MINUTE, between);
String closeWellTime;
if (endDate.compareTo(dateFlag) > 0) {
closeWellTime = BusinessConstant.END_OF_DAY_TIME;
} else {
closeWellTime = endDate.toString(BusinessConstant.MINUTES_FORMAT);
}
//计算偏移
this.createOptimizeLongDuration(longDurationList, duration, longPeriodId, recordId, wellheadId, null,
offset.toString(BusinessConstant.MINUTES_FORMAT), closeWellTime
);
}
}
}
}
//光伏出力峰值>=线路哪部分井口运行功率:满足的部分井口采用绿电消纳优先,不满足的井采用消峰平谷
else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment