Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
integrated-scheduling-v3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
张晓彤
integrated-scheduling-v3
Commits
35032303
Commit
35032303
authored
Oct 17, 2023
by
Allvey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
穿越装载区优化
parent
09ef446f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
27 deletions
+41
-27
config.json
config.json
+2
-1
group.py
core/group.py
+37
-24
area_analysis.py
util/area_analysis.py
+2
-2
No files found.
config.json
View file @
35032303
...
...
@@ -25,7 +25,7 @@
"password"
:
"Huituo@123"
},
"gothrough"
:
{
"closer_area_name"
:
"1025装载区0
2
"
,
"closer_area_name"
:
"1025装载区0
5
"
,
"further_area_name"
:
"1025装载区-03"
}
}
\ No newline at end of file
core/group.py
View file @
35032303
...
...
@@ -614,7 +614,7 @@ class GroupDispatcher:
if
self
.
gothrough_active
:
self
.
logger
.
info
(
"穿越装载区调度开启"
)
self
.
gothroghdispatcher
.
update_lanes_info
()
self
.
gothroghdispatcher
.
redispatch_request
(
request_truck_id
=
truck_id
,
truck
=
self
.
group
.
truck
)
self
.
gothroghdispatcher
.
redispatch_request
(
request_truck_id
=
truck_id
,
truck
=
self
.
group
.
truck
,
truck_dispatch
=
truck_dispatch
)
# if self.group.topo is not None and truck_locate is not None:
# # 穿越装载区判断
# if self.gothrough_active:
...
...
@@ -1182,8 +1182,9 @@ class GoThroughDispatcher:
# logger.info(self.closer_entrance_node_id)
logger
.
info
(
"近端道路列表"
)
logger
.
info
(
self
.
closer_area_backtrack_lanes
)
# 交叉口路段
cross_lane
=
s
tr
(
lowest_common_ancestor
.
Id
)
cross_lane
=
s
elf
.
closer_area_backtrack_lanes
[
0
]
except
Exception
as
es
:
self
.
logger
.
error
(
"回溯近端装载路段异常"
)
...
...
@@ -1197,23 +1198,23 @@ class GoThroughDispatcher:
self
.
further_area_backtrack_lanes
=
self
.
further_area_backtrack_lanes
[
0
:
self
.
further_area_backtrack_lanes
.
index
(
cross_lane
)]
# 穿越装载区检查路段
self
.
gothrough_check_lanes
=
[
cross_lane
]
try
:
# 多回溯一个路段
if
lowest_common_ancestor
.
Length
<
200
:
item
=
session_postgre
.
query
(
Lane
)
.
filter_by
(
EndNodeId
=
lowest_common_ancestor
.
StartNodeId
)
.
first
()
self
.
gothrough_check_lanes
.
append
(
str
(
item
.
Id
))
self
.
logger
.
info
(
"gothrough_check_lanes"
)
self
.
logger
.
info
(
self
.
gothrough_check_lanes
)
# # 穿越装载区检查路段
# self.gothrough_check_lanes = self.closer_area_backtrack_lanes
except
Exception
as
es
:
self
.
logger
.
error
(
"穿越装载区交叉口判断异常"
)
self
.
logger
.
error
(
es
)
# try:
# # 多回溯一个路段
# if lowest_common_ancestor.Length < 200:
# item = session_postgre.query(Lane).filter_by(EndNodeId=lowest_common_ancestor.StartNodeId).first()
# self.gothrough_check_lanes.append(str(item.Id))
#
# self.logger.info("gothrough_check_lanes")
# self.logger.info(self.gothrough_check_lanes)
#
# except Exception as es:
# self.logger.error("穿越装载区交叉口判断异常")
# self.logger.error(es)
def
redispatch_request
(
self
,
request_truck_id
:
str
,
truck
:
TruckInfo
):
def
redispatch_request
(
self
,
request_truck_id
:
str
,
truck
:
TruckInfo
,
truck_dispatch
):
# 调度开始时间
rtd_start_time
=
datetime
.
now
()
...
...
@@ -1249,8 +1250,8 @@ class GoThroughDispatcher:
# 读取车辆位置信息
truck_locates_dict
=
get_trucks_locate
()
self
.
logger
.
info
(
"truck_locates_dict"
)
self
.
logger
.
info
(
truck_locates_dict
)
#
self.logger.info("truck_locates_dict")
#
self.logger.info(truck_locates_dict)
except
Exception
as
es
:
self
.
logger
.
error
(
"车辆位置信息读取异常"
)
...
...
@@ -1303,16 +1304,15 @@ class GoThroughDispatcher:
except
Exception
as
es
:
logger
.
error
(
"寻找最优装载区异常"
)
logger
.
error
(
es
)
logger
.
info
(
f
"当前{current_truck_goto_excavator_id}"
)
logger
.
info
(
f
"目标{target_excavator}"
)
try
:
# item = (session_mysql.query(EquipmentPair).filter_by(truck_id=request_truck_id, group_id=group_id,
# isdeleted=0, ).first())
excavator_now
=
session_mysql
.
query
(
EquipmentPair
)
.
filter_by
(
truck_id
=
request_truck_id
,
isdeleted
=
0
)
.
first
()
.
exactor_id
self
.
logger
.
info
(
'查询到的挖机'
)
self
.
logger
.
info
(
excavator_now
)
self
.
logger
.
info
(
'当前目标挖机'
)
self
.
logger
.
info
(
target_excavator
)
...
...
@@ -1320,10 +1320,17 @@ class GoThroughDispatcher:
self
.
logger
.
error
(
"pair表查询异常"
)
self
.
logger
.
error
(
es
)
excavator_now
=
0
if
excavator_now
==
target_excavator
:
self
.
logger
.
info
(
"目标一致不用变更"
)
try
:
current_unload_area_id
=
session_mysql
.
query
(
EquipmentPair
)
.
filter_by
(
truck_id
=
request_truck_id
,
isdeleted
=
0
)
.
first
()
.
unload_area_id
except
Exception
as
es
:
self
.
logger
.
error
(
"pair表查询异常"
)
self
.
logger
.
error
(
es
)
if
(
target_excavator
is
not
None
)
and
(
excavator_now
!=
target_excavator
):
self
.
logger
.
info
(
f
'更新车辆 {request_truck_name} 派车计划前往 {target_excavator}'
)
# 派车计划写入redis
truck_dispatch_to_redis
(
request_truck_id
,
group_id
,
target_excavator
)
...
...
@@ -1332,6 +1339,12 @@ class GoThroughDispatcher:
# 派车计划未更改
self
.
logger
.
info
(
"派车计划未变动"
)
# 将派车计划加入 dispatch_plan
truck_dispatch
[
request_truck_id
]
=
[
target_excavator
,
current_unload_area_id
]
self
.
logger
.
info
(
f
'新派车计划'
)
self
.
logger
.
info
(
truck_dispatch
[
request_truck_id
])
self
.
logger
.
info
(
"#####################################请求调度更新结束#####################################"
)
# 调度结束时间
...
...
util/area_analysis.py
View file @
35032303
...
...
@@ -231,7 +231,7 @@ def get_trucks_locate():
# logger.error(eval(truck_locate))
if
eval
(
truck_locate
)
is
not
''
:
truck_locate_dict
[
truck_name_to_uuid_dict
[
item
]]
=
eval
(
truck_locate
)
logger
.
info
(
truck_locate_dict
)
#
logger.info(truck_locate_dict)
else
:
continue
...
...
@@ -271,7 +271,7 @@ def truck_dispatch_to_redis(truck_id, group_id, excavator_id):
logger
.
info
(
"无重复派车计划,重新生成中"
)
# 其余调度信息写入
try
:
# record["dispatchId"] = item.
id
record
[
"truckId"
]
=
truck_
id
record
[
"dispatchId"
]
=
str
(
uuid
.
uuid1
())
record
[
"exactorId"
]
=
item
.
exactor_id
record
[
"loadAreaId"
]
=
item
.
load_area_id
...
...
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