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
670e5b13
Commit
670e5b13
authored
Nov 26, 2021
by
张晓彤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复无派车计划算法终止异常
parent
435b229f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
217 additions
and
5 deletions
+217
-5
dump.py
equipment/dump.py
+27
-0
excavator.py
equipment/excavator.py
+26
-1
__init__.py
group_control/__init__.py
+8
-0
group_control.py
group_control/group_control.py
+0
-0
path_plannner.py
path_plan/path_plannner.py
+4
-0
realtime_dispatch.py
realtime_dispatch.py
+0
-0
settings.py
settings.py
+4
-4
traffic_flow_info.py
traffic_flow/traffic_flow_info.py
+148
-0
No files found.
equipment/dump.py
View file @
670e5b13
...
@@ -29,6 +29,8 @@ class DumpInfo(WalkManage):
...
@@ -29,6 +29,8 @@ class DumpInfo(WalkManage):
self
.
dump_material
=
{}
self
.
dump_material
=
{}
# 卸点优先级
# 卸点优先级
self
.
dump_priority_coefficient
=
np
.
ones
(
self
.
dynamic_dump_num
)
self
.
dump_priority_coefficient
=
np
.
ones
(
self
.
dynamic_dump_num
)
# 卸点卸载能力
self
.
dump_strength
=
np
.
zeros
(
self
.
dynamic_dump_num
)
# 初始化读取映射及路网
# 初始化读取映射及路网
self
.
period_map_para_load
()
self
.
period_map_para_load
()
...
@@ -136,6 +138,25 @@ class DumpInfo(WalkManage):
...
@@ -136,6 +138,25 @@ class DumpInfo(WalkManage):
logger
.
error
(
"无动态派车计划可用"
)
logger
.
error
(
"无动态派车计划可用"
)
logger
.
error
(
es
)
logger
.
error
(
es
)
def
update_unload_ability
(
self
):
try
:
rule3
=
session_mysql
.
query
(
DispatchRule
)
.
filter_by
(
id
=
3
)
.
first
()
if
not
rule3
.
disabled
:
for
dump_index
in
range
(
dynamic_dump_num
):
unload_area_id
=
unload_area_index_to_uuid_dict
[
self
.
dump_index_to_unload_area_index_dict
[
dump_index
]]
unload_ability
=
session_postgre
.
query
(
DumpArea
)
.
filter_by
(
Id
=
unload_area_id
)
.
first
()
.
UnloadAbililty
self
.
dump_strength
[
dump_index
]
=
unload_ability
# 卸载设备最大卸载能力,单位吨/小时
if
unload_ability
<
200
:
raise
Exception
(
"卸载点卸载能力异常"
)
else
:
self
.
dump_strength
=
np
.
full
(
self
.
num_of_dump
,
5000
)
except
Exception
as
es
:
logger
.
error
(
es
)
logger
.
error
(
"卸载点卸载信息读取异常"
)
def
reset
(
self
):
def
reset
(
self
):
# 卸载设备数量
# 卸载设备数量
self
.
dynamic_dump_num
=
get_value
(
"dynamic_dump_num"
)
self
.
dynamic_dump_num
=
get_value
(
"dynamic_dump_num"
)
...
@@ -151,6 +172,8 @@ class DumpInfo(WalkManage):
...
@@ -151,6 +172,8 @@ class DumpInfo(WalkManage):
self
.
dump_material
=
{}
self
.
dump_material
=
{}
# 卸点优先级
# 卸点优先级
self
.
dump_priority_coefficient
=
np
.
ones
(
self
.
dynamic_dump_num
)
self
.
dump_priority_coefficient
=
np
.
ones
(
self
.
dynamic_dump_num
)
# 卸点卸载能力
self
.
dump_strength
=
np
.
zeros
(
self
.
dynamic_dump_num
)
def
para_period_update
(
self
):
def
para_period_update
(
self
):
...
@@ -176,6 +199,9 @@ class DumpInfo(WalkManage):
...
@@ -176,6 +199,9 @@ class DumpInfo(WalkManage):
# 更新设备优先级
# 更新设备优先级
self
.
update_dump_priority
()
self
.
update_dump_priority
()
# 更新卸点卸载能力
self
.
update_unload_ability
()
#
#
# # 卸载目标产量
# # 卸载目标产量
# self.dump_target_mass = np.full(self.dynamic_dump_num, dump_target_mass)
# self.dump_target_mass = np.full(self.dynamic_dump_num, dump_target_mass)
\ No newline at end of file
equipment/excavator.py
View file @
670e5b13
...
@@ -33,6 +33,8 @@ class ExcavatorInfo(WalkManage):
...
@@ -33,6 +33,8 @@ class ExcavatorInfo(WalkManage):
self
.
excavator_priority_coefficient
=
np
.
ones
(
self
.
dynamic_excavator_num
)
self
.
excavator_priority_coefficient
=
np
.
ones
(
self
.
dynamic_excavator_num
)
# 挖机物料优先级
# 挖机物料优先级
self
.
excavator_material_priority
=
np
.
ones
(
self
.
dynamic_excavator_num
)
self
.
excavator_material_priority
=
np
.
ones
(
self
.
dynamic_excavator_num
)
# 挖机装载能力
self
.
excavator_strength
=
np
.
zeros
(
self
.
dynamic_excavator_num
)
# 初始化读取映射及路网
# 初始化读取映射及路网
self
.
period_map_para_load
()
self
.
period_map_para_load
()
...
@@ -162,6 +164,25 @@ class ExcavatorInfo(WalkManage):
...
@@ -162,6 +164,25 @@ class ExcavatorInfo(WalkManage):
if
self
.
excavator_material
[
excavator_id
]
==
'81bb175d-50fe-4be3-937e-6791ac4d6fec'
:
if
self
.
excavator_material
[
excavator_id
]
==
'81bb175d-50fe-4be3-937e-6791ac4d6fec'
:
self
.
excavator_material_priority
[
self
.
excavator_uuid_to_index_dict
[
excavator_id
]]
=
5
self
.
excavator_material_priority
[
self
.
excavator_uuid_to_index_dict
[
excavator_id
]]
=
5
def
update_mining_ability
(
self
):
try
:
rule4
=
session_mysql
.
query
(
DispatchRule
)
.
filter_by
(
id
=
4
)
.
first
()
if
not
rule4
.
disabled
:
for
excavator_index
in
range
(
len
(
self
.
excavator_index_to_uuid_dict
)):
load_ability
=
session_mysql
.
query
(
EquipmentSpec
.
mining_abililty
)
.
\
join
(
Equipment
,
Equipment
.
equipment_spec
==
EquipmentSpec
.
id
)
.
\
filter
(
Equipment
.
id
==
self
.
excavator_index_to_uuid_dict
[
excavator_index
])
.
first
()
self
.
excavator_strength
[
excavator_index
]
=
load_ability
.
mining_abililty
if
load_ability
.
mining_abililty
<
200
:
raise
Exception
(
"挖机装载能力异常"
)
else
:
self
.
excavator_strength
=
np
.
full
(
self
.
num_of_excavator
,
5000
)
except
Exception
as
es
:
logger
.
error
(
es
)
logger
.
error
(
"挖机装载信息信息读取异常"
)
def
reset
(
self
):
def
reset
(
self
):
# 装载设备数量
# 装载设备数量
...
@@ -180,7 +201,8 @@ class ExcavatorInfo(WalkManage):
...
@@ -180,7 +201,8 @@ class ExcavatorInfo(WalkManage):
self
.
excavator_priority_coefficient
=
np
.
ones
(
self
.
dynamic_excavator_num
)
self
.
excavator_priority_coefficient
=
np
.
ones
(
self
.
dynamic_excavator_num
)
# 挖机物料优先级
# 挖机物料优先级
self
.
excavator_material_priority
=
np
.
ones
(
self
.
dynamic_excavator_num
)
self
.
excavator_material_priority
=
np
.
ones
(
self
.
dynamic_excavator_num
)
# 挖机装载能力
self
.
excavator_strength
=
np
.
zeros
(
get_value
(
"dynamic_excavator_num"
))
def
para_period_update
(
self
):
def
para_period_update
(
self
):
...
@@ -214,3 +236,6 @@ class ExcavatorInfo(WalkManage):
...
@@ -214,3 +236,6 @@ class ExcavatorInfo(WalkManage):
# 更新挖机优先级
# 更新挖机优先级
self
.
update_excavator_priority
()
self
.
update_excavator_priority
()
# 更新挖机装载能力
self
.
update_mining_ability
()
group_control/__init__.py
0 → 100644
View file @
670e5b13
#!E:\Pycharm Projects\Waytous
# -*- coding: utf-8 -*-
# @Time : 2021/11/26 11:38
# @Author : Opfer
# @Site :
# @File : __init__.py
# @Software: PyCharm
\ No newline at end of file
group_control/group_control.py
0 → 100644
View file @
670e5b13
This diff is collapsed.
Click to expand it.
path_plan/path_plannner.py
View file @
670e5b13
...
@@ -33,7 +33,11 @@ class PathPlanner(WalkManage):
...
@@ -33,7 +33,11 @@ class PathPlanner(WalkManage):
# 路段集合
# 路段集合
self
.
lane_set
=
{}
self
.
lane_set
=
{}
# 车辆长度(暂)
# 车辆长度(暂)
try
:
self
.
truck_length
=
float
(
sum
(
self
.
truck
.
get_length
()
.
values
()))
/
len
(
self
.
truck
.
get_length
())
self
.
truck_length
=
float
(
sum
(
self
.
truck
.
get_length
()
.
values
()))
/
len
(
self
.
truck
.
get_length
())
except
Exception
as
es
:
logger
.
error
(
"无矿卡数据"
)
logger
.
error
(
es
)
self
.
truck_length
=
3
self
.
truck_length
=
3
# 装载区数量
# 装载区数量
self
.
num_of_load_area
=
len
(
set
(
update_load_area
()))
self
.
num_of_load_area
=
len
(
set
(
update_load_area
()))
...
...
realtime_dispatch.py
View file @
670e5b13
This diff is collapsed.
Click to expand it.
settings.py
View file @
670e5b13
...
@@ -55,8 +55,8 @@ log_path = para_config["log_path"]
...
@@ -55,8 +55,8 @@ log_path = para_config["log_path"]
# 创建日志目录
# 创建日志目录
if
not
os
.
path
.
exists
(
log_path
):
#
if not os.path.exists(log_path):
os
.
mkdir
(
log_path
)
#
os.mkdir(log_path)
# logging初始化工作
# logging初始化工作
logging
.
basicConfig
()
logging
.
basicConfig
()
...
@@ -65,8 +65,8 @@ logger.setLevel(logging.INFO)
...
@@ -65,8 +65,8 @@ logger.setLevel(logging.INFO)
# timefilehandler = logging.handlers.TimedRotatingFileHandler(log_path + "/dispatch.log", when='M', interval=1, backupCount=60)
# 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(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
(
"./Logs/dispatch.log"
,
maxBytes
=
3
*
1024
*
1024
,
backupCount
=
10
)
# 设置后缀名称,跟strftime的格式一样
# 设置后缀名称,跟strftime的格式一样
filehandler
.
suffix
=
"
%
Y-
%
m-
%
d_
%
H-
%
M.log"
filehandler
.
suffix
=
"
%
Y-
%
m-
%
d_
%
H-
%
M.log"
...
...
traffic_flow/traffic_flow_info.py
View file @
670e5b13
...
@@ -14,6 +14,154 @@ from equipment.dump import DumpInfo
...
@@ -14,6 +14,154 @@ from equipment.dump import DumpInfo
from
equipment.truck
import
TruckInfo
from
equipment.truck
import
TruckInfo
class
Traffic_flow
(
WalkManage
):
def
__init__
(
self
,
dump
,
excavator
,
truck
):
self
.
dump
=
dump
self
.
excavator
=
excavator
self
.
truck
=
truck
# 驶往挖机的实际车流
self
.
actual_goto_excavator_traffic_flow
=
np
.
zeros
(
(
dump
.
get_dump_num
(),
excavator
.
get_excavator_num
())
)
# 驶往卸载设备的实际车流
self
.
actual_goto_dump_traffic_flow
=
np
.
zeros
(
(
excavator
.
get_excavator_num
(),
dump
.
get_dump_num
())
)
# 驶往挖机的实际车次
self
.
goto_dump_truck_num
=
np
.
zeros
(
(
excavator
.
get_excavator_num
(),
dump
.
get_dump_num
())
)
# 驶往卸载设备的实际车次
self
.
goto_excavator_truck_num
=
np
.
zeros
(
(
dump
.
get_dump_num
(),
excavator
.
get_excavator_num
())
)
# 驶往挖机的理想车流
self
.
opt_goto_dump_traffic_flow
=
np
.
zeros
(
(
excavator
.
get_excavator_num
(),
dump
.
get_dump_num
())
)
# 驶往卸载设备的实际车流
self
.
opt_goto_excavator_traffic_flow
=
np
.
zeros
(
(
dump
.
get_dump_num
(),
excavator
.
get_excavator_num
())
)
# 更新实际交通流
def
update_actual_traffic_flow
(
self
):
# 装载周期参数
self
.
period_map_para_load
()
self
.
period_walk_para_load
()
loading_task_time
=
self
.
excavator
.
get_loading_task_time
()
unloading_task_time
=
self
.
dump
.
get_unloading_task_time
()
truck_current_task
=
self
.
truck
.
get_truck_current_task
()
truck_current_trip
=
self
.
truck
.
get_truck_current_trip
()
payload
=
self
.
truck
.
get_payload
()
dynamic_dump_num
=
get_value
(
"dynamic_dump_num"
)
dynamic_excavator_num
=
get_value
(
"dynamic_excavator_num"
)
dynamic_truck_num
=
get_value
(
"dynamic_truck_num"
)
self
.
goto_dump_truck_num
=
np
.
zeros
((
dynamic_excavator_num
,
dynamic_dump_num
))
self
.
actual_goto_dump_traffic_flow
=
np
.
zeros
(
(
dynamic_excavator_num
,
dynamic_dump_num
)
)
self
.
goto_excavator_truck_num
=
np
.
zeros
(
(
dynamic_dump_num
,
dynamic_excavator_num
)
)
self
.
actual_goto_excavator_traffic_flow
=
np
.
zeros
(
(
dynamic_dump_num
,
dynamic_excavator_num
)
)
# try:
logger
.
info
(
"dynamic_truck_num"
)
logger
.
info
(
dynamic_truck_num
)
print
(
"truck.truck_index_to_uuid_dict"
)
print
(
self
.
truck
.
truck_index_to_uuid_dict
)
print
(
"truck_current_task"
)
print
(
truck_current_task
)
for
i
in
range
(
dynamic_truck_num
):
task
=
truck_current_task
[
self
.
truck
.
truck_index_to_uuid_dict
[
i
]]
end_area_index
=
truck_current_trip
[
i
][
1
]
start_area_index
=
truck_current_trip
[
i
][
0
]
if
task
in
heavy_task_set
:
self
.
goto_dump_truck_num
[
start_area_index
][
end_area_index
]
+=
1
self
.
actual_goto_dump_traffic_flow
[
start_area_index
][
end_area_index
]
+=
float
(
payload
[
i
])
# logger.info("debug2")
if
task
in
empty_task_set
:
self
.
goto_excavator_truck_num
[
start_area_index
][
end_area_index
]
+=
1
self
.
actual_goto_excavator_traffic_flow
[
start_area_index
][
end_area_index
]
+=
float
(
payload
[
i
])
self
.
actual_goto_dump_traffic_flow
=
self
.
actual_goto_dump_traffic_flow
/
(
self
.
distance_to_dump
.
reshape
(
dynamic_excavator_num
,
dynamic_dump_num
)
/
(
1000
*
empty_speed
)
+
np
.
expand_dims
(
unloading_task_time
,
axis
=
0
)
.
repeat
(
dynamic_excavator_num
,
axis
=
0
)
)
self
.
actual_goto_excavator_traffic_flow
=
(
self
.
actual_goto_excavator_traffic_flow
/
(
self
.
distance_to_excavator
.
reshape
(
dynamic_dump_num
,
dynamic_excavator_num
)
/
(
1000
*
heavy_speed
)
+
np
.
expand_dims
(
loading_task_time
,
axis
=
0
)
.
repeat
(
dynamic_dump_num
,
axis
=
0
)
)
)
logger
.
info
(
"self.goto_dump_truck_num"
)
logger
.
info
(
self
.
goto_dump_truck_num
)
logger
.
info
(
"self.actual_goto_dump_traffic_flow"
)
logger
.
info
(
self
.
actual_goto_dump_traffic_flow
)
logger
.
info
(
"self.goto_excavator_truck_num"
)
logger
.
info
(
self
.
goto_excavator_truck_num
)
logger
.
info
(
"self.actual_goto_excavator_traffic_flow"
)
logger
.
info
(
self
.
actual_goto_excavator_traffic_flow
)
# except Exception as es:
# logger.error("未知错误001")
# logger.error(es)
# print("驶往卸点实际载重")
# print(self.actual_goto_dump_traffic_flow)
# print("卸点路段行驶时间(h)")
# print((self.distance_to_dump.reshape(dynamic_excavator_num, dynamic_dump_num) / (1000 * empty_speed)))
# print("驶往卸点实际车流")
# print(self.actual_goto_dump_traffic_flow)
logger
.
info
(
"驶往卸点实际载重"
)
logger
.
info
(
self
.
actual_goto_dump_traffic_flow
)
logger
.
info
(
"卸点路段行驶时间(h)"
)
logger
.
info
(
(
self
.
distance_to_dump
.
reshape
(
dynamic_excavator_num
,
dynamic_dump_num
)
/
(
1000
*
empty_speed
)
)
)
logger
.
info
(
"驶往卸点实际车流"
)
logger
.
info
(
self
.
actual_goto_dump_traffic_flow
)
logger
.
info
(
"________________loading_task_time__________"
)
logger
.
info
(
loading_task_time
)
# 车流规划类
# 车流规划类
class
Traffic_para
(
WalkManage
):
class
Traffic_para
(
WalkManage
):
def
__init__
(
self
,
num_of_load_area
,
num_of_unload_area
,
num_of_excavator
,
num_of_dump
,
truck
):
def
__init__
(
self
,
num_of_load_area
,
num_of_unload_area
,
num_of_excavator
,
num_of_dump
,
truck
):
...
...
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