Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
integrated-scheduling
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
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
张晓彤
integrated-scheduling
Commits
1529bf4c
Commit
1529bf4c
authored
Oct 11, 2021
by
Allvey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复派车计划变动BUG
parent
d950f451
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
211 additions
and
80 deletions
+211
-80
dump.py
equipment/dump.py
+24
-9
excavator.py
equipment/excavator.py
+35
-6
truck.py
equipment/truck.py
+44
-39
para_config.py
para_config.py
+59
-1
path_plannner.py
path_plan/path_plannner.py
+19
-15
priority_control.py
path_plan/priority_control.py
+12
-4
realtime_dispatch.py
realtime_dispatch.py
+0
-0
settings.py
settings.py
+4
-4
traffic_flow_info.py
traffic_flow/traffic_flow_info.py
+14
-2
No files found.
equipment/dump.py
View file @
1529bf4c
...
...
@@ -14,9 +14,9 @@ from settings import *
class
DumpInfo
(
WalkManage
):
def
__init__
(
self
):
# 卸载设备数量
self
.
dynamic_dump_num
=
len
(
dynamic_dump_set
)
self
.
dynamic_dump_num
=
get_value
(
"dynamic_dump_num"
)
# 用于动态调度的卸载设备集合
self
.
dynamic_dump_set
=
[]
self
.
dynamic_dump_set
=
get_value
(
"dynamic_dump_set"
)
# 开始时间
self
.
start_time
=
datetime
.
now
()
# 卸载时间
...
...
@@ -115,17 +115,18 @@ class DumpInfo(WalkManage):
def
update_dump_material
(
self
):
self
.
dump_material
=
{}
for
dump_id
in
dynamic_dump_set
:
for
dump_id
in
self
.
dynamic_dump_set
:
try
:
unload_area_id
=
session_mysql
.
query
(
Dispatch
)
.
filter_by
(
dump_id
=
dump_id
,
isauto
=
1
,
isdeleted
=
0
)
.
first
()
.
unload_area_id
dump_material_id
=
session_postgre
.
query
(
DumpArea
)
.
filter_by
(
Id
=
unload_area_id
)
.
first
()
.
Material
self
.
dump_material
[
dump_id
]
=
dump_material_id
except
Exception
as
es
:
logger
.
error
(
"无动态派车计划可用"
)
logger
.
error
(
es
)
def
update_dump_priority
(
self
):
self
.
dump_priority_coefficient
=
np
.
ones
(
self
.
dynamic_dump_num
)
for
dump_id
in
dynamic_dump_set
:
for
dump_id
in
self
.
dynamic_dump_set
:
try
:
unload_area_index
=
self
.
dump_index_to_unload_area_index_dict
[
self
.
dump_uuid_to_index_dict
[
dump_id
]]
unload_area_id
=
unload_area_index_to_uuid_dict
[
unload_area_index
]
...
...
@@ -133,9 +134,28 @@ class DumpInfo(WalkManage):
self
.
dump_priority_coefficient
[
self
.
dump_uuid_to_index_dict
[
dump_id
]]
+=
item
.
Priority
except
Exception
as
es
:
logger
.
error
(
"无动态派车计划可用"
)
logger
.
error
(
es
)
def
reset
(
self
):
# 卸载设备数量
self
.
dynamic_dump_num
=
get_value
(
"dynamic_dump_num"
)
# 用于动态调度的卸载设备集合
self
.
dynamic_dump_set
=
get_value
(
"dynamic_dump_set"
)
# 卸载时间
self
.
unloading_time
=
np
.
zeros
(
self
.
dynamic_dump_num
)
# 入场时间
self
.
entrance_time
=
np
.
zeros
(
self
.
dynamic_dump_num
)
# 出场时间
self
.
exit_time
=
np
.
zeros
(
self
.
dynamic_dump_num
)
# 卸载点物料类型
self
.
dump_material
=
{}
# 卸点优先级
self
.
dump_priority_coefficient
=
np
.
ones
(
self
.
dynamic_dump_num
)
def
para_period_update
(
self
):
self
.
reset
()
# print("Dump update!")
logger
.
info
(
"Dump update!"
)
...
...
@@ -145,11 +165,6 @@ class DumpInfo(WalkManage):
self
.
period_walk_para_load
()
# 用于动态调度的卸载设备
self
.
dynamic_dump_set
=
set
(
update_autodisp_dump
())
self
.
dynamic_dump_num
=
len
(
self
.
dynamic_dump_set
)
# 计算平均卸载时间
self
.
update_dump_unloadtime
()
...
...
equipment/excavator.py
View file @
1529bf4c
...
...
@@ -77,6 +77,8 @@ class ExcavatorInfo(WalkManage):
except
Exception
as
es
:
logger
.
error
(
f
"挖机 {excavator_id} 装载时间信息缺失, 已设为默认值(1min)"
)
logger
.
error
(
es
)
print
(
"loading_time"
,
self
.
loading_time
)
print
(
"excavator_uuid_to_index_dict"
,
self
.
excavator_uuid_to_index_dict
)
self
.
loading_time
[
self
.
excavator_uuid_to_index_dict
[
excavator_id
]]
=
5.00
# 更新挖机设备出入时间
...
...
@@ -122,17 +124,23 @@ class ExcavatorInfo(WalkManage):
return
loading_task_time
def
update_excavator_material
(
self
):
for
excavator_id
in
dynamic_excavator_set
:
load_area_id
=
session_mysql
.
query
(
Dispatch
)
.
filter_by
(
exactor_id
=
excavator_id
,
isdeleted
=
0
,
isauto
=
1
)
.
first
()
.
load_area_id
excavator_material_id
=
session_postgre
.
query
(
DiggingWorkArea
)
.
filter_by
(
Id
=
load_area_id
)
.
first
()
.
Material
self
.
excavator_material
[
excavator_id
]
=
excavator_material_id
print
(
"here"
,
self
.
dynamic_excavator_set
)
for
excavator_id
in
self
.
dynamic_excavator_set
:
try
:
load_area_id
=
session_mysql
.
query
(
Dispatch
)
.
filter_by
(
exactor_id
=
excavator_id
,
isdeleted
=
0
,
isauto
=
1
)
.
first
()
.
load_area_id
excavator_material_id
=
session_postgre
.
query
(
DiggingWorkArea
)
.
filter_by
(
Id
=
load_area_id
)
.
first
()
.
Material
self
.
excavator_material
[
excavator_id
]
=
excavator_material_id
except
Exception
as
es
:
logger
.
warning
(
es
)
def
update_excavator_priority
(
self
):
self
.
excavator_material_priority
=
np
.
ones
(
dynamic_excavator_num
)
print
(
"dynamic_excavator_set"
,
self
.
dynamic_excavator_set
)
for
excavator_id
in
dynamic_excavator_set
:
for
excavator_id
in
self
.
dynamic_excavator_set
:
item
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
excavator_id
)
.
first
()
print
(
"excavator_priority_coefficient"
,
self
.
excavator_priority_coefficient
)
print
(
self
.
excavator_uuid_to_index_dict
)
self
.
excavator_priority_coefficient
[
self
.
excavator_uuid_to_index_dict
[
excavator_id
]]
=
item
.
priority
+
1
# 物料优先级控制
...
...
@@ -149,9 +157,30 @@ class ExcavatorInfo(WalkManage):
if
self
.
excavator_material
[
excavator_id
]
==
'c481794b-6ced-45b9-a9c4-c4a388f44418'
:
self
.
excavator_material_priority
[
self
.
excavator_uuid_to_index_dict
[
excavator_id
]]
=
5
def
reset
(
self
):
# 装载设备数量
self
.
dynamic_excavator_num
=
get_value
(
"dynamic_excavator_num"
)
# 用于动态调度的卸载设备集合
self
.
dynamic_excavator_set
=
get_value
(
"dynamic_excavator_set"
)
# 装载时间
self
.
loading_time
=
np
.
zeros
(
self
.
dynamic_excavator_num
)
# 入场时间
self
.
entrance_time
=
np
.
zeros
(
self
.
dynamic_excavator_num
)
# 出场时间
self
.
exit_time
=
np
.
zeros
(
self
.
dynamic_excavator_num
)
# 挖机对应物料类型
self
.
excavator_material
=
{}
# 挖机设备优先级
self
.
excavator_priority_coefficient
=
np
.
ones
(
self
.
dynamic_excavator_num
)
# 挖机物料优先级
self
.
excavator_material_priority
=
np
.
ones
(
self
.
dynamic_excavator_num
)
def
para_period_update
(
self
):
self
.
reset
()
logger
.
info
(
"Excavator update!"
)
# 装载周期参数
...
...
equipment/truck.py
View file @
1529bf4c
...
...
@@ -66,7 +66,8 @@ class TruckInfo(WalkManage):
self
.
truck_material_bind
=
{}
# 矿卡绑定物料modify
self
.
dump_material_bind_modify
=
np
.
full
((
self
.
dynamic_truck_num
,
dynamic_dump_num
),
0
)
self
.
excavator_material_bind_modify
=
np
.
zeros
(
self
.
dynamic_truck_num
)
# self.excavator_material_bind_modify =np.zeros(self.dynamic_truck_num)
self
.
excavator_material_bind_modify
=
np
.
full
((
self
.
dynamic_truck_num
,
dynamic_excavator_num
),
0
)
# 初始化读取映射及路网
self
.
period_map_para_load
()
self
.
period_walk_para_load
()
...
...
@@ -289,33 +290,34 @@ class TruckInfo(WalkManage):
# 更新矿卡实际容量
def
update_truck_payload
(
self
):
try
:
self
.
payload
=
np
.
zeros
(
self
.
dynamic_truck_num
)
for
truck_id
in
self
.
dynamic_truck_set
:
trcuk_index
=
self
.
truck_uuid_to_index_dict
[
truck_id
]
truck_spec
=
(
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
truck_id
)
.
first
()
.
equipment_spec
)
# truck_spec = query.equipment_spec
self
.
payload
[
trcuk_index
]
=
(
session_mysql
.
query
(
EquipmentSpec
)
.
filter_by
(
id
=
truck_spec
)
.
first
()
.
capacity
)
except
Exception
as
es
:
logger
.
error
(
"读取矿卡有效载重异常-矿卡型号信息缺失"
)
logger
.
error
(
es
)
self
.
payload
=
np
.
full
(
self
.
dynamic_truck_num
,
220
);
# try:
# self.payload = np.zeros(self.dynamic_truck_num)
# for truck_id in self.dynamic_truck_set:
# trcuk_index = self.truck_uuid_to_index_dict[truck_id]
# truck_spec = (
# session_mysql.query(Equipment)
# .filter_by(id=truck_id)
# .first()
# .equipment_spec
# )
# # truck_spec = query.equipment_spec
# self.payload[trcuk_index] = (
# session_mysql.query(EquipmentSpec)
# .filter_by(id=truck_spec)
# .first()
# .capacity
# )
# except Exception as es:
# logger.error("读取矿卡有效载重异常-矿卡型号信息缺失")
# logger.error(es)
def
update_truck_priority
(
self
):
self
.
truck_priority
=
np
.
full
(
self
.
dynamic_truck_num
,
0
)
rule6
=
session_mysql
.
query
(
DispatchRule
)
.
filter_by
(
id
=
6
)
.
first
()
if
rule6
.
disabled
==
0
:
for
truck_id
in
dynamic_truck_set
:
for
truck_id
in
self
.
dynamic_truck_set
:
item
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
truck_id
)
.
first
()
truck_index
=
self
.
truck_uuid_to_index_dict
[
truck_id
]
if
item
.
priority
==
0
:
...
...
@@ -347,7 +349,7 @@ class TruckInfo(WalkManage):
rule5
=
session_mysql
.
query
(
DispatchRule
)
.
filter_by
(
id
=
5
)
.
first
()
if
rule5
.
disabled
==
0
:
self
.
truck_excavator_bind
=
{}
for
excavator_id
in
dynamic_excavator_set
:
for
excavator_id
in
get_value
(
"dynamic_excavator_set"
)
:
item
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
excavator_id
)
.
first
()
if
item
.
bind_list
is
not
None
:
for
truck_name
in
json
.
loads
(
item
.
bind_list
):
...
...
@@ -369,14 +371,14 @@ class TruckInfo(WalkManage):
try
:
rule5
=
session_mysql
.
query
(
DispatchRule
)
.
filter_by
(
id
=
5
)
.
first
()
if
rule5
.
disabled
==
0
:
for
excavator_id
in
dynamic_excavator_set
:
for
excavator_id
in
get_value
(
"dynamic_excavator_set"
)
:
item
=
(
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
excavator_id
,
only_allowed
=
1
)
.
first
()
)
if
item
is
not
None
:
for
truck_id
in
dynamic_truck_set
:
for
truck_id
in
self
.
dynamic_truck_set
:
if
truck_uuid_to_name_dict
[
truck_id
]
not
in
item
.
bind_list
:
self
.
truck_excavator_exclude
[
truck_id
]
=
excavator_id
self
.
excavator_exclude_modify
[
...
...
@@ -393,17 +395,14 @@ class TruckInfo(WalkManage):
def
update_truck_material
(
self
):
excavator
.
update_excavator_material
()
dump
.
update_dump_material
()
self
.
truck_material_bind
=
{}
self
.
update_truck_excavator_bind
()
self
.
update_truck_dump_area_bind
()
self
.
excavator_material_bind_modify
=
np
.
full
((
self
.
dynamic_truck_num
,
dynamic_excavator_num
),
0
)
self
.
dump_material_bind_modify
=
np
.
full
((
self
.
dynamic_truck_num
,
dynamic_dump_num
),
0
)
self
.
excavator_material_bind_modify
=
np
.
full
((
self
.
dynamic_truck_num
,
get_value
(
"dynamic_excavator_num"
)
),
0
)
self
.
dump_material_bind_modify
=
np
.
full
((
self
.
dynamic_truck_num
,
get_value
(
"dynamic_dump_num"
)
),
0
)
for
truck_id
in
dynamic_truck_set
:
for
truck_id
in
self
.
dynamic_truck_set
:
truck_index
=
self
.
truck_uuid_to_index_dict
[
truck_id
]
...
...
@@ -418,40 +417,42 @@ class TruckInfo(WalkManage):
excavator_material_id
=
excavator
.
excavator_material
[
excavator_id
]
self
.
truck_material_bind
[
truck_id
]
=
excavator_material_id
for
truck_id
in
dynamic_truck_set
:
for
truck_id
in
self
.
dynamic_truck_set
:
truck_index
=
self
.
truck_uuid_to_index_dict
[
truck_id
]
print
(
"excavator_material_bind_modify"
,
self
.
excavator_material_bind_modify
)
if
truck_id
in
self
.
truck_material_bind
:
material
=
self
.
truck_material_bind
[
truck_id
]
for
excavator_id
in
dynamic_excavator_set
:
for
excavator_id
in
get_value
(
"dynamic_excavator_set"
)
:
excavator_material_id
=
excavator
.
excavator_material
[
excavator_id
]
excavator_index
=
excavator
.
excavator_uuid_to_index_dict
[
excavator_id
]
print
(
truck_index
,
excavator_index
)
if
excavator_material_id
!=
material
:
self
.
excavator_material_bind_modify
[
truck_index
][
excavator_index
]
=
1000000
for
dump_id
in
dynamic_dump_set
:
for
dump_id
in
get_value
(
"dynamic_dump_set"
)
:
dump_material_id
=
dump
.
dump_material
[
dump_id
]
dump_index
=
dump
.
dump_uuid_to_index_dict
[
dump_id
]
if
dump_material_id
!=
material
:
self
.
dump_material_bind_modify
[
truck_index
][
dump_index
]
=
1000000
def
update_truck_spec
(
self
):
for
truck_id
in
dynamic_truck_set
:
for
truck_id
in
self
.
dynamic_truck_set
:
self
.
size
[
truck_id
]
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
truck_id
)
.
first
()
.
equipment_spec
def
update_truck_size
(
self
):
self
.
update_truck_spec
()
for
truck_id
in
dynamic_truck_set
:
for
truck_id
in
self
.
dynamic_truck_set
:
truck_spec_id
=
self
.
size
[
truck_id
]
self
.
geo_length
[
truck_id
]
=
session_mysql
.
query
(
EquipmentSpec
)
.
filter_by
(
id
=
truck_spec_id
)
.
first
()
.
length
self
.
geo_width
[
truck_spec_id
]
=
session_mysql
.
query
(
EquipmentSpec
)
.
filter_by
(
id
=
truck_spec_id
)
.
first
()
.
width
def
update_truck_speed
(
self
):
for
truck_id
in
dynamic_truck_set
:
for
truck_id
in
self
.
dynamic_truck_set
:
self
.
empty_speed
[
truck_id
]
=
session_mysql
.
query
(
EquipmentSpec
)
.
\
join
(
Equipment
,
EquipmentSpec
.
id
==
Equipment
.
equipment_spec
)
.
\
filter
(
Equipment
.
id
==
truck_id
)
.
first
()
.
max_speed
...
...
@@ -480,10 +481,14 @@ class TruckInfo(WalkManage):
self
.
truck_material_bind
=
{}
# 矿卡绑定物料modify
self
.
dump_material_bind_modify
=
np
.
full
((
self
.
dynamic_truck_num
,
dynamic_excavator_num
),
0
)
self
.
excavator_material_bind_modify
=
np
.
zeros
(
self
.
dynamic_truck_num
)
# self.excavator_material_bind_modify =np.zeros(self.dynamic_truck_num)
self
.
excavator_material_bind_modify
=
np
.
full
((
self
.
dynamic_truck_num
,
dynamic_excavator_num
),
0
)
def
para_period_update
(
self
):
excavator
.
para_period_update
()
dump
.
para_period_update
()
# 初始化参数
self
.
reset
()
...
...
para_config.py
View file @
1529bf4c
...
...
@@ -144,7 +144,24 @@ class DeviceMap:
def
get_truck_index_to_uuid_dict
(
self
):
return
self
.
truck_index_to_uuid_dict
def
reset
(
self
):
self
.
excavator_uuid_to_index_dict
=
{}
self
.
dump_uuid_to_index_dict
=
{}
self
.
excavator_index_to_uuid_dict
=
{}
self
.
dump_index_to_uuid_dict
=
{}
self
.
dump_uuid_to_unload_area_uuid_dict
=
{}
self
.
excavator_uuid_to_load_area_uuid_dict
=
{}
self
.
excavator_index_to_load_area_index_dict
=
{}
self
.
dump_index_to_unload_area_index_dict
=
{}
self
.
truck_uuid_to_index_dict
=
{}
self
.
truck_index_to_uuid_dict
=
{}
def
period_map_para_update
(
self
):
self
.
reset
()
device_map_dict
=
update_deveices_map
(
unload_area_uuid_to_index_dict
,
load_area_uuid_to_index_dict
)
...
...
@@ -261,9 +278,32 @@ class WalkManage(DeviceMap):
def
get_distance_park_to_excavator
(
self
):
return
self
.
distance_park_to_excavator
def
reset
(
self
):
# 路网真实距离
self
.
walk_time_to_excavator
=
np
.
full
(
(
dynamic_dump_num
,
dynamic_excavator_num
),
M
)
self
.
walk_time_to_dump
=
np
.
full
((
dynamic_dump_num
,
dynamic_excavator_num
),
M
)
self
.
walk_time_park_to_excavator
=
np
.
full
((
park_num
,
dynamic_excavator_num
),
M
)
self
.
walk_time_park_to_load_area
=
np
.
full
((
park_num
,
load_area_num
),
M
)
self
.
walk_time_to_load_area
=
np
.
full
((
unload_area_num
,
load_area_num
),
M
)
self
.
walk_time_to_unload_area
=
np
.
full
((
unload_area_num
,
load_area_num
),
M
)
# 路网行驶时间
self
.
distance_to_excavator
=
np
.
full
(
(
dynamic_dump_num
,
dynamic_excavator_num
),
M
)
self
.
distance_to_dump
=
np
.
full
((
dynamic_dump_num
,
dynamic_excavator_num
),
M
)
self
.
distance_park_to_excavator
=
np
.
full
((
park_num
,
dynamic_excavator_num
),
M
)
self
.
distance_park_to_load_area
=
np
.
full
((
park_num
,
load_area_num
),
M
)
self
.
distance_to_load_area
=
np
.
full
((
unload_area_num
,
load_area_num
),
M
)
self
.
distance_to_unload_area
=
np
.
full
((
unload_area_num
,
load_area_num
),
M
)
def
period_walk_para_update
(
self
):
self
.
period_map_para_load
()
self
.
reset
()
self
.
period_map_para_update
()
# 计算路网距离及行走时间
try
:
...
...
@@ -364,6 +404,8 @@ walk_manage = WalkManage()
device_map
.
period_map_para_update
()
walk_manage
.
period_map_para_load
()
walk_manage
.
period_walk_para_update
()
...
...
@@ -431,6 +473,22 @@ def period_para_update():
global_dict
[
"dynamic_dump_set"
]
=
dynamic_dump_set
global_dict
[
"dynamic_dump_num"
]
=
dynamic_dump_num
global_dict
[
"distance_to_excavator"
]
=
walk_manage
.
distance_to_excavator
global_dict
[
"distance_park_to_excavator"
]
=
walk_manage
.
distance_park_to_excavator
global_dict
[
"distance_to_dump"
]
=
walk_manage
.
distance_to_dump
print
(
"walk_manage_para"
)
print
(
"distance_to_excavator"
,
walk_manage
.
distance_to_excavator
)
print
(
"distance_park_to_excavator"
,
walk_manage
.
distance_park_to_excavator
)
print
(
"distance_to_dump"
,
walk_manage
.
distance_to_dump
)
print
(
"excavator_uuid_to_index_dict"
,
walk_manage
.
excavator_uuid_to_index_dict
)
print
(
"dump_uuid_to_index_dict"
,
walk_manage
.
dump_uuid_to_index_dict
)
print
(
"here5"
,
walk_manage
.
distance_park_to_excavator
)
def
get_value
(
name
):
return
global_dict
[
name
]
path_plan/path_plannner.py
View file @
1529bf4c
...
...
@@ -166,32 +166,36 @@ class PathPlanner(WalkManage):
logger
.
error
(
'路网信息计成本计算异常'
)
logger
.
error
(
es
)
cost_to_excavator
=
np
.
zeros_like
(
self
.
distance_to_excavator
)
cost_to_dump
=
np
.
zeros_like
(
self
.
distance_to_dump
)
cost_park_to_excavator
=
np
.
zeros_like
(
self
.
distance_park_to_excavator
)
cost_to_excavator
=
np
.
zeros_like
(
get_value
(
"distance_to_excavator"
)
)
cost_to_dump
=
np
.
zeros_like
(
get_value
(
"distance_to_dump"
)
)
cost_park_to_excavator
=
np
.
zeros_like
(
get_value
(
"distance_park_to_excavator"
)
)
try
:
# 路网权重
walk_weight
,
park_walk_weight
=
weighted_walk_cost
()
print
(
"here4"
,
self
.
distance_park_to_excavator
)
# 路网禁用关系
walk_available
=
available_walk
()
# try:
# 路网权重
walk_weight
,
park_walk_weight
=
weighted_walk_cost
()
print
(
"path_weight"
,
walk_weight
)
# 路网禁用关系
walk_available
=
available_walk
()
print
(
"walk_avail"
,
walk_available
)
print
(
"path_weight"
,
walk_weight
)
except
Exception
as
es
:
logger
.
error
(
"无派车计划可用"
)
print
(
"walk_avail"
,
walk_available
)
# except Exception as es:
# logger.error("无派车计划可用")
for
i
in
range
(
dynamic_dump_num
):
for
j
in
range
(
dynamic_excavator_num
):
for
i
in
range
(
get_value
(
"dynamic_dump_num"
)
):
for
j
in
range
(
get_value
(
"dynamic_excavator_num"
)
):
load_area_index
=
self
.
excavator_index_to_load_area_index_dict
[
j
]
unload_area_index
=
self
.
dump_index_to_unload_area_index_dict
[
i
]
print
(
"here6"
,
cost_to_excavator
)
print
(
"here7"
,
self
.
cost_to_load_area
)
cost_to_excavator
[
i
][
j
]
=
self
.
cost_to_load_area
[
unload_area_index
][
load_area_index
]
/
walk_weight
[
i
][
j
]
cost_to_dump
[
i
][
j
]
=
self
.
cost_to_unload_area
[
unload_area_index
][
load_area_index
]
/
walk_weight
[
i
][
j
]
*
walk_available
[
i
][
j
]
for
j
in
range
(
dynamic_excavator_num
):
for
j
in
range
(
get_value
(
"dynamic_excavator_num"
)
):
load_area_index
=
self
.
excavator_index_to_load_area_index_dict
[
j
]
cost_park_to_excavator
[
0
][
j
]
=
self
.
cost_park_to_load_area
[
0
][
load_area_index
]
/
park_walk_weight
[
0
][
j
]
...
...
path_plan/priority_control.py
View file @
1529bf4c
...
...
@@ -17,8 +17,12 @@ dump = DumpInfo()
def
weighted_walk_cost
():
excavator
.
update_excavator_priority
()
dump
.
update_dump_priority
()
dynamic_dump_num
=
get_value
(
"dynamic_dump_num"
)
dynamic_excavator_num
=
get_value
(
"dynamic_excavator_num"
)
dynamic_dump_set
=
get_value
(
"dynamic_dump_set"
)
dynamic_excavator_set
=
get_value
(
"dynamic_excavator_set"
)
excavator
.
para_period_update
()
dump
.
para_period_update
()
walk_weight
=
np
.
ones
((
dynamic_dump_num
,
dynamic_excavator_num
))
excavator_priority
=
excavator
.
excavator_priority_coefficient
excavator_material_priority
=
excavator
.
excavator_material_priority
...
...
@@ -56,8 +60,12 @@ def weighted_walk_cost():
def
available_walk
():
excavator
.
update_excavator_material
()
dump
.
update_dump_material
()
dynamic_dump_num
=
get_value
(
"dynamic_dump_num"
)
dynamic_excavator_num
=
get_value
(
"dynamic_excavator_num"
)
dynamic_dump_set
=
get_value
(
"dynamic_dump_set"
)
dynamic_excavator_set
=
get_value
(
"dynamic_excavator_set"
)
excavator
.
para_period_update
()
dump
.
para_period_update
()
walk_weight
=
np
.
ones
((
dynamic_dump_num
,
dynamic_excavator_num
))
for
dump_id
in
dynamic_dump_set
:
...
...
realtime_dispatch.py
View file @
1529bf4c
This diff is collapsed.
Click to expand it.
settings.py
View file @
1529bf4c
...
...
@@ -27,8 +27,8 @@ import time
log_path
=
"/usr/local/fleet-log/dispatch"
# 创建日志目录
if
not
os
.
path
.
exists
(
log_path
):
os
.
mkdir
(
log_path
)
#
if not os.path.exists(log_path):
#
os.mkdir(log_path)
# logging初始化工作
logging
.
basicConfig
()
...
...
@@ -38,8 +38,8 @@ logger.setLevel(logging.INFO)
# timefilehandler = logging.handlers.TimedRotatingFileHandler(log_path + "/dispatch.log", when='M', interval=1, backupCount=60)
filehandler
=
logging
.
handlers
.
RotatingFileHandler
(
log_path
+
"/dispatch.log"
,
maxBytes
=
3
*
1024
*
1024
,
backupCount
=
10
)
#
filehandler = logging.handlers.RotatingFileHandler("./Logs/dispatch.log", maxBytes=3 * 1024 * 1024, backupCount=10)
#
filehandler = logging.handlers.RotatingFileHandler(log_path + "/dispatch.log", maxBytes=3*1024*1024, backupCount=10)
filehandler
=
logging
.
handlers
.
RotatingFileHandler
(
"./Logs/dispatch.log"
,
maxBytes
=
3
*
1024
*
1024
,
backupCount
=
10
)
# 设置后缀名称,跟strftime的格式一样
filehandler
.
suffix
=
"
%
Y-
%
m-
%
d_
%
H-
%
M.log"
...
...
traffic_flow/traffic_flow_info.py
View file @
1529bf4c
...
...
@@ -40,8 +40,14 @@ class Traffic_para(WalkManage):
# self.payload = 200 # 有效载重(不同型号矿卡载重不同,这里暂时认为车队是同质的)
self
.
payload
=
np
.
mean
(
truck
.
get_payload
())
self
.
empty_speed
=
sum
(
truck
.
empty_speed
.
values
())
/
truck
.
get_truck_num
()
# 空载矿卡平均时速
self
.
heavy_speed
=
sum
(
truck
.
heavy_speed
.
values
())
/
truck
.
get_truck_num
()
# 重载矿卡平均时速
try
:
self
.
empty_speed
=
sum
(
truck
.
empty_speed
.
values
())
/
truck
.
get_truck_num
()
# 空载矿卡平均时速
self
.
heavy_speed
=
sum
(
truck
.
heavy_speed
.
values
())
/
truck
.
get_truck_num
()
# 重载矿卡平均时速
except
Exception
as
es
:
self
.
empty_speed
=
25
self
.
heavy_speed
=
22
logger
.
warning
(
"矿卡速度设置为默认值"
)
logger
.
warning
(
es
)
self
.
min_throughout
=
1000
# 最小产量约束
self
.
truck_total_num
=
0
...
...
@@ -139,6 +145,12 @@ class Traffic_para(WalkManage):
self
.
goto_unload_area_factor
[
load_area_index
][
unload_area_index
]
=
\
(
cost_to_unload_area
[
unload_area_index
][
load_area_index
]
/
(
heavy_speed
*
1000
))
/
self
.
payload
print
((
cost_to_unload_area
[
unload_area_index
][
load_area_index
]
/
(
heavy_speed
*
1000
)))
print
(
self
.
payload
)
print
(
"goto_unload_area_factor"
,
self
.
goto_unload_area_factor
)
print
(
"cost_to_unload_area"
,
cost_to_unload_area
)
except
Exception
as
es
:
logger
.
error
(
es
)
logger
.
error
(
"车流规划信息计算异常"
)
...
...
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