Commit 2cd49cca authored by 张晓彤's avatar 张晓彤

路径修改

parents bdb62c7a b6bf7ded
File added
# Default ignored files
/workspace.xml
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData">
<serverData>
<paths name="root@172.16.0.103:22">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
</serverData>
</component>
</project>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="Python 3.7 (waytous)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (waytous)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/integrated-scheduling-v3.iml" filepath="$PROJECT_DIR$/.idea/integrated-scheduling-v3.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
{
"para": {
<<<<<<< HEAD
"log_path": "E:\\Pycharm Projects\\Waytous\\",
"empty_speed": 25,
"heavy_speed": 22,
=======
"log_path": "/usr/local/fleet-log/dispatch",
"empty_speed": 17,
"heavy_speed": 17,
>>>>>>> new
"dump_target_mass": 5000,
"excavator_target_mass": 5000
},
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
#!E:\Pycharm Projects\Waytous
# -*- coding: utf-8 -*-
# @Time : 2021/9/3 14:44
# @Author : Opfer
# @Site :
# @File : priority_control.py
# @Software: PyCharm
from equipment.truck import *
from equipment.dump import *
from equipment.excavator import *
from para_config import *
from path_plan.topo_graph import *
class PriorityController():
def __init__(self, dump, excavator, truck):
# 设备类
self.dump = dump
self.excavator = excavator
self.truck = truck
# 获取日志器
self.logger = get_logger("zxt.prio")
def weighted_walk_calc(self):
"""
计算运输路线权重, 权重影响因素:设备优先级, 物料优先级,
:return:
walk_weight: 卸载-装载区 路网权重
park_walk_weight: 备停区-装载区 路网权重
"""
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")
walk_to_excavator_weight = np.ones((dynamic_dump_num, dynamic_excavator_num))
walk_to_dump_weight = np.ones((dynamic_excavator_num, dynamic_dump_num))
excavator_priority = self.excavator.excavator_priority_coefficient
excavator_material_priority = self.excavator.excavator_material_priority
dump_priority = self.dump.dump_priority_coefficient
dump_material_priority = np.ones(dynamic_dump_num)
park_walk_weight = np.ones((park_num, dynamic_excavator_num))
rule6 = session_mysql.query(DispatchRule).filter_by(id=6).first()
if not rule6.disabled:
for dump_id in dynamic_dump_set:
for excavator_id in dynamic_excavator_set:
dump_index = self.dump.dump_uuid_to_index_dict[dump_id]
excavator_inedx = self.excavator.excavator_uuid_to_index_dict[excavator_id]
walk_to_excavator_weight[dump_index][excavator_inedx] += excavator_priority[excavator_inedx]
walk_to_dump_weight[excavator_inedx][dump_index] += dump_priority[dump_index]
park_walk_weight = park_walk_weight * self.excavator.excavator_priority_coefficient
rule7 = session_mysql.query(DispatchRule).filter_by(id=7).first()
if not rule7.disabled:
for dump_id in dynamic_dump_set:
for excavator_id in dynamic_excavator_set:
dump_index = self.dump.dump_uuid_to_index_dict[dump_id]
excavator_inedx = self.excavator.excavator_uuid_to_index_dict[excavator_id]
walk_to_excavator_weight[dump_index][excavator_inedx] += excavator_material_priority[excavator_inedx]
walk_to_dump_weight[excavator_inedx][dump_index] += dump_material_priority[dump_index]
park_walk_weight = park_walk_weight * self.excavator.excavator_material_priority
try:
walk_to_excavator_weight = walk_to_excavator_weight - (walk_to_excavator_weight.min() - 1)
walk_to_dump_weight = walk_to_dump_weight - (walk_to_dump_weight.min() - 1)
park_walk_weight = park_walk_weight - (park_walk_weight.min() - 1)
except Exception as es:
self.logger.errro(es)
self.logger.error("优先级归一化异常")
return walk_to_excavator_weight, walk_to_dump_weight, park_walk_weight
def walk_available_calc(self):
"""
计算路网可通行性(物料, 地图, 分组三者综合)
:return:
walk_available: 路网可通行性(dump_num, excavator_num)
"""
map_walk_available = self.update_map_walk_available()
group_walk_available = self.update_group_walk_available()
material_walk_available = self.update_material_walk_available()
walk_available = map_walk_available * group_walk_available * material_walk_available
return walk_available
def update_group_walk_available(self):
"""
计算调度分组间的路网可通行性, 不同分组间路网不可通行
:return:
group_walk_available: 调度分组路网可通行性矩阵(dump_num, excavator_num)
"""
group_walk_available = np.zeros((get_value("dynamic_dump_num"), get_value("dynamic_excavator_num")))
for dump_id in get_value("dynamic_dump_set"):
for excavator_id in get_value("dynamic_excavator_set"):
item = session_mysql.query(Dispatch).filter_by(dump_id=dump_id, exactor_id=excavator_id, isauto=1,
isdeleted=0).first()
if item is not None:
dump_index = self.dump.dump_uuid_to_index_dict[dump_id]
excavator_index = self.excavator.excavator_uuid_to_index_dict[excavator_id]
group_walk_available[dump_index][excavator_index] = 1
return group_walk_available
def update_material_walk_available(self):
"""
更新物料兼容性下路网可通行性
:return:
walk_available: 物料兼容路网可通行性矩阵(dump_num, excavator_num)
"""
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")
walk_available = np.ones((dynamic_dump_num, dynamic_excavator_num))
try:
for dump_id in dynamic_dump_set:
for excavator_id in dynamic_excavator_set:
dump_index = self.dump.dump_uuid_to_index_dict[dump_id]
excavator_inedx = self.excavator.excavator_uuid_to_index_dict[excavator_id]
# 两设备处理物料不同, 相关路网不可通行
if self.excavator.excavator_material[excavator_id] != self.dump.dump_material[dump_id]:
walk_available[dump_index][excavator_inedx] = 0
except Exception as es:
self.logger.info(es)
self.logger.info("error-12")
return walk_available
def update_map_walk_available(self):
"""
更新物理路网可通行性
:return:
walk_available: 物理路网可通行性矩阵(dump_num, excavator_num)
"""
dynamic_dump_num = get_value("dynamic_dump_num")
dynamic_excavator_num = get_value("dynamic_excavator_num")
walk_available = np.ones((dynamic_dump_num, dynamic_excavator_num))
walk_manage.period_walk_para_update()
for dump_index in range(dynamic_dump_num):
for excavator_index in range(dynamic_excavator_num):
if walk_manage.distance_to_excavator[dump_index][excavator_index] > M / 2:
walk_available[dump_index][excavator_index] = 0
return walk_available
from topo_graph import *
import networkx as nx
import matplotlib.pyplot as plt
#
# topo = Topo()
# topo.generate_topo_graph()
# load_G = topo.get_load_G()
# pos = nx.shell_layout(load_G)
# nx.draw(load_G, pos, with_labels=True, node_color='red', edge_color='blue', font_size=18, width=5, node_size=600,
# alpha=0.5)
# plt.show()
This diff is collapsed.
......@@ -47,6 +47,9 @@ dump_target_mass = para_config["dump_target_mass"]
# 挖机目标装载量
excavator_target_mass = para_config["excavator_target_mass"]
logger = logging.getLogger("zxt")
logger.setLevel(logging.INFO)
def set_log():
......@@ -62,9 +65,6 @@ def set_log():
# logging初始化工作
logging.basicConfig()
logger = logging.getLogger("zxt")
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment