Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gf_back
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tianchao
gf_back
Commits
f782f97b
Commit
f782f97b
authored
Sep 18, 2023
by
ZWT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(能源管理系统): 间开优化定时任务
1.开发间开优化长期间开优化定时任务,完成并网流程绿电消纳优先策略; BREAKING CHANGE: 无 Closes 无 [skip ci]
parent
cd16f8c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
240 additions
and
200 deletions
+240
-200
C11-space/pps-core-space/src/main/java/pps/core/space/service/SpaceOptimizeLongCloudServiceImpl.java
...core/space/service/SpaceOptimizeLongCloudServiceImpl.java
+240
-200
No files found.
C11-space/pps-core-space/src/main/java/pps/core/space/service/SpaceOptimizeLongCloudServiceImpl.java
View file @
f782f97b
...
@@ -104,7 +104,6 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
...
@@ -104,7 +104,6 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
for
(
SpaceInstitutionDetailEnt
detail
:
detailEntList
)
{
for
(
SpaceInstitutionDetailEnt
detail
:
detailEntList
)
{
String
detailId
=
detail
.
getId
();
String
detailId
=
detail
.
getId
();
String
lineId
=
detail
.
getLineId
();
String
lineId
=
detail
.
getLineId
();
Integer
startInterval
=
0
;
//创建记录
//创建记录
String
longPeriodId
=
this
.
createOptimizeLongPeriod
(
longPeriodList
,
detailId
,
lineId
,
executionCycleForMonth
,
optimizeDeadline
);
String
longPeriodId
=
this
.
createOptimizeLongPeriod
(
longPeriodList
,
detailId
,
lineId
,
executionCycleForMonth
,
optimizeDeadline
);
switch
(
detail
.
getGridTypeKey
())
{
switch
(
detail
.
getGridTypeKey
())
{
...
@@ -158,115 +157,8 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
...
@@ -158,115 +157,8 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
int
compare
=
powerMax
.
compareTo
(
wellheadTotalPower
);
int
compare
=
powerMax
.
compareTo
(
wellheadTotalPower
);
//光伏出力峰值大于等于井口总功率:绿电消纳优先策略
//光伏出力峰值大于等于井口总功率:绿电消纳优先策略
if
(
compare
>=
BusinessConstant
.
ZERO
)
{
if
(
compare
>=
BusinessConstant
.
ZERO
)
{
//---------------------------------井口优化---------------------------------
//---------------------------------绿电消纳策略---------------------------------
int
between
=
0
;
this
.
greenElectricityConsumptionStrategy
(
longDurationList
,
wellheadViewList
,
longWellheadList
,
avgPowerList
,
durationMap
,
detail
,
longPeriodId
);
//判断是否第一口井
boolean
isFirstWellhead
;
//第一口井启动时间
DateTime
firstStartTime
=
null
;
//井口累积运行总功率
BigDecimal
totalOperatingPower
=
BigDecimal
.
ZERO
;
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
());
//取当前井口最大发电量
BigDecimal
serviceRating
=
wellhead
.
getServiceRating
();
List
<
SpaceInstitutionDurationEnt
>
durationConfigList
=
durationMap
.
get
(
wellhead
);
if
(
CollUtil
.
isEmpty
(
durationConfigList
))
{
//没有设置时间段,无法优化
continue
;
}
if
(
w
==
0
)
{
//第一个井口
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
++)
{
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
)
{
firstStartTime
=
startTime
;
//计算开井时间
int
startIndex
=
0
;
for
(
int
a
=
0
,
avgPowerSize
=
avgPowerList
.
size
();
a
<
avgPowerSize
;
a
++)
{
DynamicQueryPlantPredictedPowerOutput
predictedPower
=
avgPowerList
.
get
(
a
);
//当日时间段平均光伏出力>=第一口井运行负荷时,该时间为第一口井运行时间
if
(
predictedPower
.
getPower
().
compareTo
(
serviceRating
)
>=
BusinessConstant
.
ZERO
)
{
startIndex
=
a
;
break
;
}
}
DynamicQueryPlantPredictedPowerOutput
start
=
avgPowerList
.
get
(
startIndex
);
String
startTimeString
=
start
.
getHourTime
()
+
start
.
getMinTime
();
//计算第一次关井时间,按照间开时间段顺延
int
startDuration
=
(
int
)
startTime
.
between
(
endTime
,
DateUnit
.
MINUTE
);
DateTime
endTimeOptimize
=
startTime
.
offset
(
DateField
.
MINUTE
,
startDuration
);
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
startTimeString
,
endTimeOptimize
.
toString
(
BusinessConstant
.
MINUTES_FORMAT
)
);
//计算时间偏移
DateTime
startTimeOptimize
=
DateUtil
.
parse
(
startTimeString
,
BusinessConstant
.
TIME_FORMAT
);
//取时间间隔(分钟)
between
=
BaseUtils
.
getTimeDifferenceMinute
(
startTimeOptimize
,
startTime
);
}
//其它井口的第一次启动时间
else
{
DateTime
startTimeOffset
=
firstStartTime
.
offset
(
DateField
.
MINUTE
,
startInterval
);
int
startIndex
=
-
1
;
BigDecimal
add
=
serviceRating
.
add
(
totalOperatingPower
);
for
(
int
a
=
0
,
avgPowerSize
=
avgPowerList
.
size
();
a
<
avgPowerSize
;
a
++)
{
DynamicQueryPlantPredictedPowerOutput
predictedPower
=
avgPowerList
.
get
(
a
);
if
(
DateUtil
.
parse
(
predictedPower
.
getHourTime
()
+
predictedPower
.
getMinTime
(),
BusinessConstant
.
TIME_FORMAT
)
.
compareTo
(
startTimeOffset
)
>=
0
)
{
//判断第一口井启动时间+启动间隔时日平均光伏出力-前两口井的运行功率是否为正数
if
(
predictedPower
.
getPower
().
compareTo
(
add
)
>=
0
)
{
//确定第二口井第一次开井时间为第一口井启动时间+启动间隔
startIndex
=
a
;
break
;
}
}
}
if
(
startIndex
>
-
1
)
{
DynamicQueryPlantPredictedPowerOutput
start
=
avgPowerList
.
get
(
startIndex
);
DateTime
startTimeOptimize
=
DateUtil
.
parse
(
start
.
getHourTime
()
+
start
.
getMinTime
(),
BusinessConstant
.
TIME_FORMAT
);
//计算未优化启动间隔
int
openDuration
=
(
int
)
startTime
.
between
(
endTime
,
DateUnit
.
MINUTE
);
DateTime
endTimeOptimize
=
startTimeOptimize
.
offset
(
DateField
.
MINUTE
,
openDuration
);
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
openWellTime
,
BaseUtils
.
getEndTimeString
(
endTimeOptimize
)
);
//取时间间隔(分钟)
between
=
BaseUtils
.
getTimeDifferenceMinute
(
endTimeOptimize
,
endTime
);
}
else
{
//无法优化
}
}
}
else
{
DateTime
offset
=
startTime
.
offset
(
DateField
.
MINUTE
,
between
);
if
(
offset
.
compareTo
(
BusinessConstant
.
DATE_FLAG
)
>
0
)
{
//如果时间超过当天,舍弃
continue
;
}
//计算偏移
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
offset
.
toString
(
BusinessConstant
.
MINUTES_FORMAT
),
BaseUtils
.
getEndTimeString
(
DateUtil
.
parse
(
duration
.
getCloseWellTime
()
+
BusinessConstant
.
INITIALIZATION_SECOND
,
BusinessConstant
.
TIME_FORMAT
)
.
offset
(
DateField
.
MINUTE
,
between
))
);
}
}
}
}
else
{
}
else
{
//遍历井口,按发电功率大于等于光伏出力峰值条件分组
//遍历井口,按发电功率大于等于光伏出力峰值条件分组
Map
<
Boolean
,
List
<
SpaceInstitutionWellheadView
>>
collect
=
spaceWellheadList
.
stream
()
Map
<
Boolean
,
List
<
SpaceInstitutionWellheadView
>>
collect
=
spaceWellheadList
.
stream
()
...
@@ -280,96 +172,8 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
...
@@ -280,96 +172,8 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
int
lowWellheadListSize
=
lowWellheadList
.
size
();
int
lowWellheadListSize
=
lowWellheadList
.
size
();
//光伏出力峰值<任何一口井的运行功率:消峰平谷策略
//光伏出力峰值<任何一口井的运行功率:消峰平谷策略
if
(
size
==
lowWellheadListSize
)
{
if
(
size
==
lowWellheadListSize
)
{
//---------------------------------井口优化---------------------------------
//---------------------------------消峰平谷策略---------------------------------
//通过线路ID和月份获取市电峰谷策略明细配置
this
.
peakEliminationAndValleyLevelingStrategy
(
context
,
longWellheadList
,
longDurationList
,
wellheadViewList
,
durationMap
,
detail
,
lineId
,
monthNum
,
longPeriodId
);
List
<
GetBasePriceStrategyDetailOutput
>
strategyDetailList
=
ServiceUtil
.
getStrategyDetailList
(
context
,
GetBasePriceStrategyDetailInput
.
builder
()
.
lineId
(
lineId
)
.
strategyMonth
(
String
.
valueOf
(
monthNum
))
.
build
()
);
if
(
CollUtil
.
isEmpty
(
strategyDetailList
))
{
//没有配置,不优化
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
)
{
//计算优化后的时间差优化后的第一口井开井时间-优化前第一次开井时间
int
startDuration
=
(
int
)
startTime
.
between
(
endTime
,
DateUnit
.
MINUTE
);
//第一次关井时间按照启动时长顺延
DateTime
endTimeOptimize
=
startTime
.
offset
(
DateField
.
MINUTE
,
startDuration
);
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
strategyDetailOutput
.
getStartTime
(),
endTimeOptimize
.
toString
(
BusinessConstant
.
MINUTES_FORMAT
)
);
//取时间间隔(分钟)
between
=
BaseUtils
.
getTimeDifferenceMinute
(
firstEndTime
,
endTime
);
}
//其它井口的第一次启动时间
else
{
//其它井启动时间:第一口井启动时间+启动间隔
DateTime
startTimeOffset
=
firstStartTime
.
offset
(
DateField
.
MINUTE
,
startInterval
);
DateTime
endTimeOffset
=
firstEndTime
.
offset
(
DateField
.
MINUTE
,
startInterval
);
//取时间间隔(分钟)
between
=
BaseUtils
.
getTimeDifferenceMinute
(
firstEndTime
,
endTime
);
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
(
BusinessConstant
.
DATE_FLAG
)
>
0
)
{
//如果时间超过当天,舍弃
continue
;
}
//计算偏移
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
offset
.
toString
(
BusinessConstant
.
MINUTES_FORMAT
),
BaseUtils
.
getEndTimeString
(
DateUtil
.
parse
(
duration
.
getCloseWellTime
()
+
BusinessConstant
.
INITIALIZATION_SECOND
,
BusinessConstant
.
TIME_FORMAT
)
.
offset
(
DateField
.
MINUTE
,
between
)
)
);
}
}
}
}
}
//光伏出力峰值>=线路哪部分井口运行功率:满足的部分井口采用绿电消纳优先,不满足的井采用消峰平谷
//光伏出力峰值>=线路哪部分井口运行功率:满足的部分井口采用绿电消纳优先,不满足的井采用消峰平谷
else
{
else
{
...
@@ -426,6 +230,242 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
...
@@ -426,6 +230,242 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
/*-----------------------------------private-----------------------------------*/
/*-----------------------------------private-----------------------------------*/
/**
* 消峰平谷策略
*
* @param context 上下文
* @param longWellheadList 长井口列表
* @param longDurationList 长期清单
* @param wellheadViewList 井口视图列表
* @param durationMap 持续时间图
* @param detail 细节
* @param lineId 线路id
* @param monthNum 月份
* @param longPeriodId 长周期id
*/
private
void
peakEliminationAndValleyLevelingStrategy
(
XContext
context
,
List
<
SpaceOptimizeLongWellheadView
>
longWellheadList
,
List
<
SpaceOptimizeLongDurationView
>
longDurationList
,
List
<
SpaceInstitutionWellheadView
>
wellheadViewList
,
Map
<
String
,
List
<
SpaceInstitutionDurationEnt
>>
durationMap
,
SpaceInstitutionDetailEnt
detail
,
String
lineId
,
int
monthNum
,
String
longPeriodId
)
{
//通过线路ID和月份获取市电峰谷策略明细配置
List
<
GetBasePriceStrategyDetailOutput
>
strategyDetailList
=
ServiceUtil
.
getStrategyDetailList
(
context
,
GetBasePriceStrategyDetailInput
.
builder
()
.
lineId
(
lineId
)
.
strategyMonth
(
String
.
valueOf
(
monthNum
))
.
build
()
);
if
(
CollUtil
.
isEmpty
(
strategyDetailList
))
{
//没有配置,不优化
return
;
}
//获取第一段谷电阶段的开始时间为第一口井的开井时间
Optional
<
GetBasePriceStrategyDetailOutput
>
low
=
strategyDetailList
.
stream
()
.
filter
(
s
->
!
StringUtils
.
isAnyBlank
(
s
.
getEndTime
(),
s
.
getStartTime
())
&&
StringUtils
.
equals
(
"LOW"
,
s
.
getPeriodTypeKey
()))
.
findFirst
();
if
(!
low
.
isPresent
())
{
//没有谷电,不优化
return
;
}
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
;
//启动间隔累积
int
startInterval
=
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
)
{
//计算优化后的时间差优化后的第一口井开井时间-优化前第一次开井时间
int
startDuration
=
(
int
)
startTime
.
between
(
endTime
,
DateUnit
.
MINUTE
);
//第一次关井时间按照启动时长顺延
DateTime
endTimeOptimize
=
startTime
.
offset
(
DateField
.
MINUTE
,
startDuration
);
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
strategyDetailOutput
.
getStartTime
(),
endTimeOptimize
.
toString
(
BusinessConstant
.
MINUTES_FORMAT
)
);
//取时间间隔(分钟)
between
=
BaseUtils
.
getTimeDifferenceMinute
(
firstEndTime
,
endTime
);
}
//其它井口的第一次启动时间
else
{
//其它井启动时间:第一口井启动时间+启动间隔
DateTime
startTimeOffset
=
firstStartTime
.
offset
(
DateField
.
MINUTE
,
startInterval
);
DateTime
endTimeOffset
=
firstEndTime
.
offset
(
DateField
.
MINUTE
,
startInterval
);
//取时间间隔(分钟)
between
=
BaseUtils
.
getTimeDifferenceMinute
(
firstEndTime
,
endTime
);
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
(
BusinessConstant
.
DATE_FLAG
)
>
0
)
{
//如果时间超过当天,舍弃
continue
;
}
//计算偏移
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
offset
.
toString
(
BusinessConstant
.
MINUTES_FORMAT
),
BaseUtils
.
getEndTimeString
(
DateUtil
.
parse
(
duration
.
getCloseWellTime
()
+
BusinessConstant
.
INITIALIZATION_SECOND
,
BusinessConstant
.
TIME_FORMAT
)
.
offset
(
DateField
.
MINUTE
,
between
)
)
);
}
}
}
}
/**
* 绿电消纳策略
*
* @param longDurationList 长期清单
* @param wellheadViewList 井口视图列表
* @param longWellheadList 长井口列表
* @param avgPowerList 平均功率列表
* @param durationMap 持续时间图
* @param detail 细节
* @param longPeriodId 长周期id
*/
private
void
greenElectricityConsumptionStrategy
(
List
<
SpaceOptimizeLongDurationView
>
longDurationList
,
List
<
SpaceInstitutionWellheadView
>
wellheadViewList
,
List
<
SpaceOptimizeLongWellheadView
>
longWellheadList
,
List
<
DynamicQueryPlantPredictedPowerOutput
>
avgPowerList
,
Map
<
String
,
List
<
SpaceInstitutionDurationEnt
>>
durationMap
,
SpaceInstitutionDetailEnt
detail
,
String
longPeriodId
)
{
//---------------------------------井口优化---------------------------------
//时间差
int
between
=
0
;
//启动间隔累积
int
startInterval
=
0
;
//判断是否第一口井
boolean
isFirstWellhead
;
//第一口井启动时间
DateTime
firstStartTime
=
null
;
//井口累积运行总功率
BigDecimal
totalOperatingPower
=
BigDecimal
.
ZERO
;
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
());
//取当前井口最大发电量
BigDecimal
serviceRating
=
wellhead
.
getServiceRating
();
List
<
SpaceInstitutionDurationEnt
>
durationConfigList
=
durationMap
.
get
(
wellhead
);
if
(
CollUtil
.
isEmpty
(
durationConfigList
))
{
//没有设置时间段,无法优化
continue
;
}
if
(
w
==
0
)
{
//第一个井口
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
++)
{
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
)
{
firstStartTime
=
startTime
;
//计算开井时间
int
startIndex
=
0
;
for
(
int
a
=
0
,
avgPowerSize
=
avgPowerList
.
size
();
a
<
avgPowerSize
;
a
++)
{
DynamicQueryPlantPredictedPowerOutput
predictedPower
=
avgPowerList
.
get
(
a
);
//当日时间段平均光伏出力>=第一口井运行负荷时,该时间为第一口井运行时间
if
(
predictedPower
.
getPower
().
compareTo
(
serviceRating
)
>=
BusinessConstant
.
ZERO
)
{
startIndex
=
a
;
break
;
}
}
DynamicQueryPlantPredictedPowerOutput
start
=
avgPowerList
.
get
(
startIndex
);
String
startTimeString
=
start
.
getHourTime
()
+
start
.
getMinTime
();
//计算第一次关井时间,按照间开时间段顺延
int
startDuration
=
(
int
)
startTime
.
between
(
endTime
,
DateUnit
.
MINUTE
);
DateTime
endTimeOptimize
=
startTime
.
offset
(
DateField
.
MINUTE
,
startDuration
);
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
startTimeString
,
endTimeOptimize
.
toString
(
BusinessConstant
.
MINUTES_FORMAT
)
);
//计算时间偏移
DateTime
startTimeOptimize
=
DateUtil
.
parse
(
startTimeString
,
BusinessConstant
.
TIME_FORMAT
);
//取时间间隔(分钟)
between
=
BaseUtils
.
getTimeDifferenceMinute
(
startTimeOptimize
,
startTime
);
}
//其它井口的第一次启动时间
else
{
DateTime
startTimeOffset
=
firstStartTime
.
offset
(
DateField
.
MINUTE
,
startInterval
);
int
startIndex
=
-
1
;
BigDecimal
add
=
serviceRating
.
add
(
totalOperatingPower
);
for
(
int
a
=
0
,
avgPowerSize
=
avgPowerList
.
size
();
a
<
avgPowerSize
;
a
++)
{
DynamicQueryPlantPredictedPowerOutput
predictedPower
=
avgPowerList
.
get
(
a
);
if
(
DateUtil
.
parse
(
predictedPower
.
getHourTime
()
+
predictedPower
.
getMinTime
(),
BusinessConstant
.
TIME_FORMAT
)
.
compareTo
(
startTimeOffset
)
>=
0
)
{
//判断第一口井启动时间+启动间隔时日平均光伏出力-前两口井的运行功率是否为正数
if
(
predictedPower
.
getPower
().
compareTo
(
add
)
>=
0
)
{
//确定第二口井第一次开井时间为第一口井启动时间+启动间隔
startIndex
=
a
;
break
;
}
}
}
if
(
startIndex
>
-
1
)
{
DynamicQueryPlantPredictedPowerOutput
start
=
avgPowerList
.
get
(
startIndex
);
DateTime
startTimeOptimize
=
DateUtil
.
parse
(
start
.
getHourTime
()
+
start
.
getMinTime
(),
BusinessConstant
.
TIME_FORMAT
);
//计算未优化启动间隔
int
openDuration
=
(
int
)
startTime
.
between
(
endTime
,
DateUnit
.
MINUTE
);
DateTime
endTimeOptimize
=
startTimeOptimize
.
offset
(
DateField
.
MINUTE
,
openDuration
);
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
openWellTime
,
BaseUtils
.
getEndTimeString
(
endTimeOptimize
)
);
//取时间间隔(分钟)
between
=
BaseUtils
.
getTimeDifferenceMinute
(
endTimeOptimize
,
endTime
);
}
else
{
//无法优化
}
}
}
else
{
DateTime
offset
=
startTime
.
offset
(
DateField
.
MINUTE
,
between
);
if
(
offset
.
compareTo
(
BusinessConstant
.
DATE_FLAG
)
>
0
)
{
//如果时间超过当天,舍弃
continue
;
}
//计算偏移
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
offset
.
toString
(
BusinessConstant
.
MINUTES_FORMAT
),
BaseUtils
.
getEndTimeString
(
DateUtil
.
parse
(
duration
.
getCloseWellTime
()
+
BusinessConstant
.
INITIALIZATION_SECOND
,
BusinessConstant
.
TIME_FORMAT
)
.
offset
(
DateField
.
MINUTE
,
between
))
);
}
}
}
}
/**
/**
* 创建长期优化信息
* 创建长期优化信息
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment