Commit 23931c85 authored by 张晓彤's avatar 张晓彤

监控与计划不一致-跳过异常

parent ff11acca
......@@ -230,25 +230,61 @@ class Dispatcher(WalkManage):
rule4 = session_mysql.query(DispatchRule).filter_by(id=4).first().disabled
# 读取优先级设置
excavator_priority_coefficient = self.excavator.excavator_priority_coefficient
try:
excavator_material_priority = self.excavator.excavator_material_priority
# 读取优先级设置
excavator_priority_coefficient = self.excavator.excavator_priority_coefficient
# 矿卡序号
truck_index = self.truck.truck_uuid_to_index_dict[truck_id]
excavator_material_priority = self.excavator.excavator_material_priority
# 矿卡行程
trip = self.truck.get_truck_current_trip()[truck_index]
except Exception as es:
self.logger.error("挖机优先级信息读取异常")
self.logger.error(es)
# 矿卡任务
task = self.truck.get_truck_current_task()[self.truck.truck_index_to_uuid_dict[truck_index]]
try:
# 矿卡序号
truck_index = self.truck.truck_uuid_to_index_dict[truck_id]
except Exception as es:
self.logger.error("矿卡基本信息读取异常")
self.logger.error(es)
try:
# 矿卡行程
trip = self.truck.get_truck_current_trip()[truck_index]
except Exception as es:
self.logger.error("矿卡行程读取异常")
self.logger.error(es)
try:
# 矿卡任务
task = self.truck.get_truck_current_task()[self.truck.truck_index_to_uuid_dict[truck_index]]
except Exception as es:
self.logger.error("矿卡任务读取异常")
self.logger.error(es)
try:
# 调度分组
group_id = self.group.dispatch_truck_group[truck_id]
# 调度分组
group_id = self.group.dispatch_truck_group[truck_id]
# 记录当前调度车辆信息
current_truck = CurrentTruck(truck_id, group_id, trip, task)
except Exception as es:
self.logger.error("调度分组读取异常")
self.logger.error(es)
try:
# 记录当前调度车辆信息
current_truck = CurrentTruck(truck_id, group_id, trip, task)
except Exception as es:
self.logger.error("调度车辆对象构建异常")
self.logger.error(es)
if truck_id not in self.group.dispatch_truck_group:
self.logger.error("无该矿卡")
......
......@@ -390,29 +390,29 @@ class TruckInfo(WalkManage):
self.logger.error(es)
continue
# try:
# 若矿卡状态为空运(含装载出场)
if task in [0, 1, 2]:
# 结束设备index
end_eqp_index = self.excavator_uuid_to_index_dict[item.exactor_id]
# 目的地矿卡数加一
self.excavator_hold_truck_num[end_eqp_index] = self.excavator_hold_truck_num[end_eqp_index] + 1
# 若矿卡状态为重载(含卸载出场)
elif task in [3, 4, 5]:
# 结束设备index
end_eqp_index = self.dump_uuid_to_index_dict[item.dump_id]
# 目的地矿卡数加一
self.dump_hold_truck_num[end_eqp_index] = self.dump_hold_truck_num[end_eqp_index] + 1
# 其他状态,矿卡状态为-2,equipment_pair表不存在该矿卡
else:
pass
# except Exception as es:
# self.logger.error("矿卡行程读取异常")
# self.logger.error(es)
try:
# 若矿卡状态为空运(含装载出场)
if task in [0, 1, 2]:
# 结束设备index
end_eqp_index = self.excavator_uuid_to_index_dict[item.exactor_id]
# 目的地矿卡数加一
self.excavator_hold_truck_num[end_eqp_index] = self.excavator_hold_truck_num[end_eqp_index] + 1
# 若矿卡状态为重载(含卸载出场)
elif task in [3, 4, 5]:
# 结束设备index
end_eqp_index = self.dump_uuid_to_index_dict[item.dump_id]
# 目的地矿卡数加一
self.dump_hold_truck_num[end_eqp_index] = self.dump_hold_truck_num[end_eqp_index] + 1
# 其他状态,矿卡状态为-2,equipment_pair表不存在该矿卡
else:
pass
except Exception as es:
self.logger.error("驶往设备矿卡数量统计异常")
self.logger.error(es)
print("self.dump_hold_truck_num")
print(self.dump_hold_truck_num)
......
......@@ -18,7 +18,7 @@ class Topo():
def __init__(self):
# to unload graph
self.unload_G = nx.Graph()
self.unload_G = nx.Graph() # 建立空的简单无向图
self.unload_G_nodes = np.array(self.unload_G)
self.unload_G_num_of_nodes = self.unload_G.number_of_nodes()
......@@ -123,10 +123,11 @@ class Topo():
self.unload_G.add_node(Entrancenode_for_dump, name='dump')
try:
unload_saved_lane = []
for i in item[1]:
for i in item[1]: # for each lane in a to_unload route
i_startpoint = str(session_postgre.query(Lane).filter_by(Id=i).first().StartNodeId)
i_endpoint = str(session_postgre.query(Lane).filter_by(Id=i).first().EndNodeId)
# add [start_point, end_point, length, lane_id] to unload_saved_lane
unload_saved_lane.append([str(i_startpoint), str(i_endpoint), float(session_postgre.query(Lane).filter_by(Id=i).first().Length), i])
# son_lane_num = sum(1 for i in session_postgre.query(Lane).filter_by(StartNodeId = i_endpoint).all())
son_lane_num = len(session_postgre.query(Lane).filter_by(StartNodeId=i_endpoint).all())
......@@ -136,6 +137,8 @@ class Topo():
# print("item",item[0])
# print(unload_saved_lane)
# print("\n")
# lanes dict {lane_id: length, length}
lanes = {}
for lane_info in unload_saved_lane:
lanes[lane_info[-1]] = list([lane_info[2],lane_info[2]])
......
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