Commit c5f7aa55 authored by Allvey's avatar Allvey

优化禁止功能(python库需升级)

parent 8095d053
......@@ -426,6 +426,10 @@ class GroupDispatcher:
self.logger.info(
f'============================= 车辆调度开始 {current_truck.get_name()} =============================')
self.logger.info("配对挖机")
self.logger.info(current_truck.get_combined_excavator())
self.logger.info("配对卸点")
self.logger.info(current_truck.get_combined_unload_area())
# 全智能模式
if self.group.group_mode == 1:
self.logger.info("调度模式:全智能模式调度")
......@@ -591,14 +595,14 @@ class GroupDispatcher:
self.logger.info("穿越装载区触发路段")
self.logger.info(truck_locate)
self.logger.info(self.gothroghdispatcher.closer_area_backtrack_lanes[1:3])
self.logger.info(self.gothroghdispatcher.closer_area_backtrack_lanes[1:4])
self.logger.info(self.gothroghdispatcher.closer_area_backtrack_lanes)
# 若车辆到入场点距离大于指定阈值
if excavator_prise_location[0] != -1 and \
truck_prise_location[0] != -1 and \
haversine(excavator_prise_location, truck_prise_location) > 0.001 and \
truck_locate in self.gothroghdispatcher.closer_area_backtrack_lanes[1:3]:
truck_locate in self.gothroghdispatcher.closer_area_backtrack_lanes[1:4]:
try:
self.logger.info("触发穿越装载区调度")
planned = self.gothroghdispatcher.redispatch_request(request_truck_id=truck_id,
......@@ -629,6 +633,8 @@ class GroupDispatcher:
self.logger.error("二次调度至装载点失败")
self.logger.error(es)
planned = False
else:
self.logger.info("未触发二次调度")
# 穿越调度和二次调度均不触发,正常空载调度
if not planned or truck_task != 0:
......@@ -1020,7 +1026,7 @@ class ReDispatcher:
self.logger.info("获取车辆经纬度信息")
self.logger.info(truck_prise_location)
if not is_close_to_cross(truck_locate, truck_prise_location):
if is_close_to_cross(truck_locate, truck_prise_location):
self.logger.info(f'距离过近无法触发二次调度')
return False
......@@ -1173,6 +1179,7 @@ class ReDispatcher:
reach_time = now + traveling_time
self.logger.info(f'reach_time {reach_time}')
self.logger.info(f'excavator_avl_time {self.group.pre_sch.get_excavator_avl_time(truck_id=truck_id)[excavator_id]}')
trip_time = max(reach_time, self.group.pre_sch.get_excavator_avl_time(truck_id=truck_id)[
excavator_id]) - now
......
......@@ -8,11 +8,14 @@
import requests
from tables import *
from settings import get_logger
with open(json_file, encoding='UTF-8') as f:
mysql_config = json.load(f)["mysql"]
with open(json_file, encoding='UTF-8') as f:
geom_config = json.load(f)["geom"]
logger = get_logger("zxt.util")
# def redispatch_request(truck_id, excavator_id, unload_area_id):
# """
......@@ -75,10 +78,19 @@ def is_close_to_cross(truck_locate, truck_prise_location):
:return:
"""
try:
start_node_id = session_postgre.query(Lane).filter_by(Id=truck_locate).first().EndNodeId
start_node_gemo = str(session_postgre.query(Node).filter_by(Id=start_node_id).first().geom)
coess_pos_xy = wkb.loads(start_node_gemo)
cross_pos = [coess_pos_xy.y, coess_pos_xy.x]
except Exception as es:
logger.error(es)
logger.error(start_node_gemo)
logger.error("距离判断异常")
return False
logger.info(start_node_gemo)
logger.info("距离判断正常")
from haversine import haversine
truck_to_cross_point_dis = haversine(cross_pos, truck_prise_location)
......
......@@ -542,9 +542,19 @@ class Topo():
self.cross_bf_lanes = []
for node_id, Type in self.load_G.nodes.data('name'):
if Type is None or Type == 'None':
lanes = session_postgre.query(Lane).filter_by(EndNodeId=node_id).first()
if lanes is not None:
self.cross_bf_lanes.append(str(lanes.Id))
try:
lane = session_postgre.query(Lane).filter_by(EndNodeId=node_id).first()
if lane is not None:
self.cross_bf_lanes.append(str(lane.Id))
except Exception as es:
logger.error(es)
try:
next_lane = session_postgre.query(Lane).filter_by(EndNodeId=lane.StartNodeId).first()
if next_lane is not None:
self.cross_bf_lanes.append(str(next_lane.Id))
except Exception as es:
logger.error(es)
def get_cross_nodes(self):
return self.cross_nodes
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