Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
signal
traffic-signal-platform
Commits
238e1068
Commit
238e1068
authored
Oct 08, 2023
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 绿波评价-干线方案分析
parent
b6cf3c68
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
128 additions
and
3 deletions
+128
-3
MainlineEvaluateServiceImpl.java
...t/wanji/opt/service/impl/MainlineEvaluateServiceImpl.java
+121
-1
StrategyAndMetricsEnum.java
...n/java/net/wanji/common/enums/StrategyAndMetricsEnum.java
+6
-1
GreenwaveRealtimePO.java
...ava/net/wanji/databus/dao/entity/GreenwaveRealtimePO.java
+1
-1
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/MainlineEvaluateServiceImpl.java
View file @
238e1068
...
@@ -26,6 +26,9 @@ import org.springframework.stereotype.Service;
...
@@ -26,6 +26,9 @@ import org.springframework.stereotype.Service;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.function.Function
;
import
java.util.function.Predicate
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -604,7 +607,124 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
...
@@ -604,7 +607,124 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
}
}
private
List
<
MainlineSchemeAnalysisVO
.
GreenwaveData
>
buildGreenwaveData
(
List
<
GreenwaveHistPO
>
filteredList
)
{
private
List
<
MainlineSchemeAnalysisVO
.
GreenwaveData
>
buildGreenwaveData
(
List
<
GreenwaveHistPO
>
filteredList
)
{
return
null
;
List
<
MainlineSchemeAnalysisVO
.
GreenwaveData
>
res
=
new
ArrayList
<>();
List
<
GreenwaveHistPO
>
distinctList
=
filteredList
.
stream
()
.
filter
(
distinctByKey
(
GreenwaveHistPO:
:
getGreenwaveName
))
.
collect
(
Collectors
.
toList
());
for
(
GreenwaveHistPO
greenwaveHistPO
:
distinctList
)
{
MainlineSchemeAnalysisVO
.
GreenwaveData
greenwaveData
=
new
MainlineSchemeAnalysisVO
.
GreenwaveData
();
greenwaveData
.
setName
(
greenwaveHistPO
.
getGreenwaveName
());
Integer
greenwaveId
=
greenwaveHistPO
.
getId
();
greenwaveData
.
setDirList
(
buildDirList
(
greenwaveId
));
res
.
add
(
greenwaveData
);
}
return
res
;
}
private
List
<
MainlineSchemeAnalysisVO
.
DirectionList
>
buildDirList
(
Integer
greenwaveId
)
{
GreenwaveInfoPO
greenwaveInfoPO
=
greenwaveInfoMapper
.
selectById
(
greenwaveId
);
List
<
MainlineSchemeAnalysisVO
.
DirectionList
>
res
=
new
ArrayList
<>();
String
greenwaveName
=
greenwaveInfoPO
.
getName
();
String
[]
split
=
greenwaveName
.
split
(
" "
);
String
dirName
=
split
[
1
];
Integer
coordinateDir
=
greenwaveInfoPO
.
getDir
();
if
(
coordinateDir
==
0
)
{
// 正向
MainlineSchemeAnalysisVO
.
DirectionList
directionList
=
new
MainlineSchemeAnalysisVO
.
DirectionList
();
directionList
.
setName
(
dirName
+
"(协调方向)"
);
directionList
.
setMetricList
(
buildMetricList
(
greenwaveId
,
coordinateDir
));
res
.
add
(
directionList
);
MainlineSchemeAnalysisVO
.
DirectionList
directionList1
=
new
MainlineSchemeAnalysisVO
.
DirectionList
();
String
dirNameRev
=
reverseDirName
(
dirName
,
"向"
);
directionList1
.
setName
(
dirNameRev
+
"(非协调方向)"
);
directionList1
.
setMetricList
(
buildMetricList
(
greenwaveId
,
coordinateDir
));
res
.
add
(
directionList1
);
}
else
if
(
coordinateDir
==
1
)
{
// 反向
MainlineSchemeAnalysisVO
.
DirectionList
directionList
=
new
MainlineSchemeAnalysisVO
.
DirectionList
();
directionList
.
setName
(
dirName
+
"(非协调方向)"
);
directionList
.
setMetricList
(
buildMetricList
(
greenwaveId
,
coordinateDir
));
res
.
add
(
directionList
);
MainlineSchemeAnalysisVO
.
DirectionList
directionList1
=
new
MainlineSchemeAnalysisVO
.
DirectionList
();
String
dirNameRev
=
reverseDirName
(
dirName
,
"向"
);
directionList1
.
setName
(
dirNameRev
+
"(协调方向)"
);
directionList1
.
setMetricList
(
buildMetricList
(
greenwaveId
,
coordinateDir
));
res
.
add
(
directionList1
);
}
else
{
// 双向
MainlineSchemeAnalysisVO
.
DirectionList
directionList
=
new
MainlineSchemeAnalysisVO
.
DirectionList
();
directionList
.
setName
(
dirName
+
"(协调方向)"
);
directionList
.
setMetricList
(
buildMetricList
(
greenwaveId
,
coordinateDir
));
res
.
add
(
directionList
);
MainlineSchemeAnalysisVO
.
DirectionList
directionList1
=
new
MainlineSchemeAnalysisVO
.
DirectionList
();
String
dirNameRev
=
reverseDirName
(
dirName
,
"向"
);
directionList1
.
setName
(
dirNameRev
+
"(协调方向)"
);
directionList1
.
setMetricList
(
buildMetricList
(
greenwaveId
,
coordinateDir
));
res
.
add
(
directionList1
);
}
return
res
;
}
private
List
<
String
>
buildMetricList
(
Integer
greenwaveId
,
Integer
coordinateDir
)
{
List
<
String
>
res
=
new
ArrayList
<>();
// 确定控制策略
GreenwaveScenePO
greenwaveScenePO
=
greenwaveSceneMapper
.
selectByGreenwaveId
(
greenwaveId
);
Integer
sceneId
=
greenwaveScenePO
.
getSceneId
();
List
<
SceneStrategyPO
>
sceneStrategyPOList
=
sceneStrategyMapper
.
selectBySceneId
(
sceneId
);
Optional
<
SceneStrategyPO
>
maxPriorityPO
=
sceneStrategyPOList
.
stream
()
.
max
(
Comparator
.
comparingInt
(
SceneStrategyPO:
:
getSceneStrategyPriority
));
SceneStrategyPO
sceneStrategyPO
=
maxPriorityPO
.
get
();
Integer
strategyId
=
sceneStrategyPO
.
getStrategyId
();
StrategyPO
strategyPO
=
strategyMapper
.
selectById
(
strategyId
);
String
strategyCode
=
strategyPO
.
getStrategyCode
();
if
(
coordinateDir
==
0
||
coordinateDir
==
1
)
{
// 单向绿波
if
(
Objects
.
equals
(
strategyCode
,
StrategyAndMetricsEnum
.
Strategy
.
LINE_EFFICIENCY
.
getCode
()))
{
addMetrics
(
res
);
res
.
add
(
StrategyAndMetricsEnum
.
Metrics
.
UNCOORDINATE_PHASE_QUEUE
.
getDescription
());
}
else
if
(
Objects
.
equals
(
strategyCode
,
StrategyAndMetricsEnum
.
Strategy
.
BALANCE
.
getCode
()))
{
res
.
add
(
StrategyAndMetricsEnum
.
Metrics
.
CORD_QUEUE_RATIO
.
getDescription
());
res
.
add
(
StrategyAndMetricsEnum
.
Metrics
.
UNCOORDINATE_PHASE_QUEUE
.
getDescription
());
}
}
else
{
// 双向绿波
if
(
Objects
.
equals
(
strategyCode
,
StrategyAndMetricsEnum
.
Strategy
.
LINE_EFFICIENCY
.
getCode
()))
{
addMetrics
(
res
);
}
else
if
(
Objects
.
equals
(
strategyCode
,
StrategyAndMetricsEnum
.
Strategy
.
BALANCE
.
getCode
()))
{
res
.
add
(
StrategyAndMetricsEnum
.
Metrics
.
CORD_QUEUE_RATIO
.
getDescription
());
res
.
add
(
StrategyAndMetricsEnum
.
Metrics
.
UNCOORDINATE_PHASE_QUEUE
.
getDescription
());
}
}
return
res
;
}
private
void
addMetrics
(
List
<
String
>
res
)
{
res
.
add
(
StrategyAndMetricsEnum
.
Metrics
.
NO_PARK_PASS_RATE
.
getDescription
());
res
.
add
(
StrategyAndMetricsEnum
.
Metrics
.
TRVAL_TIME
.
getDescription
());
res
.
add
(
StrategyAndMetricsEnum
.
Metrics
.
GREEN_LIGHT_EFFICIENCY
.
getDescription
());
res
.
add
(
StrategyAndMetricsEnum
.
Metrics
.
STOP_TIMES
.
getDescription
());
res
.
add
(
StrategyAndMetricsEnum
.
Metrics
.
AVERAGE_DELAY
.
getDescription
());
res
.
add
(
StrategyAndMetricsEnum
.
Metrics
.
AVERAGE_SPEED
.
getDescription
());
res
.
add
(
StrategyAndMetricsEnum
.
Metrics
.
CORD_RELIABILITY
.
getDescription
());
}
private
String
reverseDirName
(
String
input
,
String
character
)
{
int
index
=
input
.
indexOf
(
character
);
if
(
index
!=
-
1
)
{
String
part1
=
input
.
substring
(
index
+
character
.
length
());
// Part after "向"
String
part2
=
input
.
substring
(
0
,
index
+
character
.
length
());
// Part before and including "向"
return
part1
+
part2
;
}
return
input
;
}
private
<
T
>
Predicate
<
T
>
distinctByKey
(
Function
<?
super
T
,
?>
keyExtractor
)
{
Set
<
Object
>
seen
=
ConcurrentHashMap
.
newKeySet
();
return
t
->
seen
.
add
(
keyExtractor
.
apply
(
t
));
}
}
private
List
<
String
>
calcEvaluateData
(
List
<
GreenwaveHistPO
>
filteredList
)
{
private
List
<
String
>
calcEvaluateData
(
List
<
GreenwaveHistPO
>
filteredList
)
{
...
...
wj-common/src/main/java/net/wanji/common/enums/StrategyAndMetricsEnum.java
View file @
238e1068
...
@@ -46,7 +46,12 @@ public class StrategyAndMetricsEnum {
...
@@ -46,7 +46,12 @@ public class StrategyAndMetricsEnum {
EFFUSION_RATE
(
"10"
,
"溢流率"
,
"%"
,
"effusionRate"
),
EFFUSION_RATE
(
"10"
,
"溢流率"
,
"%"
,
"effusionRate"
),
CLEAR_RATE
(
"11"
,
"绿灯间隔清空率"
,
"%"
,
"clearRate"
),
CLEAR_RATE
(
"11"
,
"绿灯间隔清空率"
,
"%"
,
"clearRate"
),
EMERGENCY_COUNT
(
"12"
,
"三急一速数量"
,
""
,
"emergencyCount"
),
EMERGENCY_COUNT
(
"12"
,
"三急一速数量"
,
""
,
"emergencyCount"
),
EMPTY_DISCHARGES
(
"13"
,
"空放次数"
,
"次"
,
"emptyDischarges"
);
EMPTY_DISCHARGES
(
"13"
,
"空放次数"
,
"次"
,
"emptyDischarges"
),
NO_PARK_PASS_RATE
(
"14"
,
"协调不停车通过率"
,
"%"
,
"noparkPassRate"
),
CORD_RELIABILITY
(
"15"
,
"协调方案可靠性"
,
"%"
,
"cordReliability"
),
CORD_QUEUE_RATIO
(
"16"
,
"协调路段排队空间占比"
,
"%"
,
"cordQueueRatio"
),
UNCOORDINATE_PHASE_QUEUE
(
"17"
,
"非协调相位二次排队"
,
"%"
,
"uncoordinatePhaseQueue"
),
TRVAL_TIME
(
"18"
,
"干线行程时间"
,
"s"
,
"trvalTime"
);
private
final
String
code
;
private
final
String
code
;
private
final
String
description
;
private
final
String
description
;
...
...
wj-databus/src/main/java/net/wanji/databus/dao/entity/GreenwaveRealtimePO.java
View file @
238e1068
...
@@ -38,7 +38,7 @@ public class GreenwaveRealtimePO {
...
@@ -38,7 +38,7 @@ public class GreenwaveRealtimePO {
@ApiModelProperty
(
name
=
"延误时间(秒)"
,
notes
=
""
)
@ApiModelProperty
(
name
=
"延误时间(秒)"
,
notes
=
""
)
private
Integer
delayTime
;
private
Integer
delayTime
;
/** 不停车通过率 */
/** 不停车通过率 */
@ApiModelProperty
(
name
=
"不停车通过率"
,
notes
=
""
)
@ApiModelProperty
(
name
=
"
协调
不停车通过率"
,
notes
=
""
)
private
Double
noparkPassRate
;
private
Double
noparkPassRate
;
@ApiModelProperty
(
name
=
"协调方案可靠性"
,
notes
=
""
)
@ApiModelProperty
(
name
=
"协调方案可靠性"
,
notes
=
""
)
...
...
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