|
|
|
@ -25,6 +25,7 @@ DEFAULT_OPTIONS = {
|
|
|
|
"terminal_exit_length": 20.0,
|
|
|
|
"terminal_exit_length": 20.0,
|
|
|
|
"lane_axis": "auto",
|
|
|
|
"lane_axis": "auto",
|
|
|
|
"lane_spacing": 10.0,
|
|
|
|
"lane_spacing": 10.0,
|
|
|
|
|
|
|
|
"segment_reuse_penalty": 200.0,
|
|
|
|
# 线槽网络相关参数。
|
|
|
|
# 线槽网络相关参数。
|
|
|
|
"use_routing_network": True,
|
|
|
|
"use_routing_network": True,
|
|
|
|
"network_entry_max_distance": 1000.0,
|
|
|
|
"network_entry_max_distance": 1000.0,
|
|
|
|
@ -791,6 +792,8 @@ def build_network_route(start_terminal, end_terminal, route_index=0, options=Non
|
|
|
|
end_key,
|
|
|
|
end_key,
|
|
|
|
bend_penalty=float(opts.get("bend_penalty", 0.0) or 0.0),
|
|
|
|
bend_penalty=float(opts.get("bend_penalty", 0.0) or 0.0),
|
|
|
|
kind_cost_factors=opts.get("carrier_kind_cost_factors", {}),
|
|
|
|
kind_cost_factors=opts.get("carrier_kind_cost_factors", {}),
|
|
|
|
|
|
|
|
segment_usage_costs=opts.get("segment_usage_costs", {}),
|
|
|
|
|
|
|
|
segment_reuse_penalty=float(opts.get("segment_reuse_penalty", 0.0) or 0.0),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
path_keys = path_result.get("path", []) if isinstance(path_result, dict) else []
|
|
|
|
path_keys = path_result.get("path", []) if isinstance(path_result, dict) else []
|
|
|
|
if not path_keys:
|
|
|
|
if not path_keys:
|
|
|
|
@ -1424,18 +1427,22 @@ def route_eplan_connections_from_payload(doc, payload, options=None, prepared_la
|
|
|
|
missing_endpoint_uuids = set()
|
|
|
|
missing_endpoint_uuids = set()
|
|
|
|
lane_indexes_by_pair = {}
|
|
|
|
lane_indexes_by_pair = {}
|
|
|
|
lane_indexes_by_segment = {}
|
|
|
|
lane_indexes_by_segment = {}
|
|
|
|
|
|
|
|
segment_usage_costs = {}
|
|
|
|
|
|
|
|
|
|
|
|
def add_status(status):
|
|
|
|
def add_status(status):
|
|
|
|
key = str(status or "").strip() or "Unknown"
|
|
|
|
key = str(status or "").strip() or "Unknown"
|
|
|
|
report["route_status_counts"][key] = report["route_status_counts"].get(key, 0) + 1
|
|
|
|
report["route_status_counts"][key] = report["route_status_counts"].get(key, 0) + 1
|
|
|
|
|
|
|
|
|
|
|
|
def create_route(route_lane_index, item, start_terminal, end_terminal, endpoint_metadata):
|
|
|
|
def create_route(route_lane_index, item, start_terminal, end_terminal, endpoint_metadata):
|
|
|
|
|
|
|
|
route_options = dict(options or {})
|
|
|
|
|
|
|
|
if isinstance(item, dict) and "__segment_usage_costs" in item:
|
|
|
|
|
|
|
|
route_options["segment_usage_costs"] = item.get("__segment_usage_costs", {})
|
|
|
|
return route_eplan_connection_between_terminals(
|
|
|
|
return route_eplan_connection_between_terminals(
|
|
|
|
doc,
|
|
|
|
doc,
|
|
|
|
start_terminal,
|
|
|
|
start_terminal,
|
|
|
|
end_terminal,
|
|
|
|
end_terminal,
|
|
|
|
route_index=route_lane_index,
|
|
|
|
route_index=route_lane_index,
|
|
|
|
options=options,
|
|
|
|
options=route_options,
|
|
|
|
wire_uuid=_wire_item_value(item, "wire_id", "wire_uuid", "id"),
|
|
|
|
wire_uuid=_wire_item_value(item, "wire_id", "wire_uuid", "id"),
|
|
|
|
wire_label=_wire_item_value(item, "wire_label", "wire_mark"),
|
|
|
|
wire_label=_wire_item_value(item, "wire_label", "wire_mark"),
|
|
|
|
net_uuid=_wire_item_value(item, "net_uuid"),
|
|
|
|
net_uuid=_wire_item_value(item, "net_uuid"),
|
|
|
|
@ -1492,7 +1499,7 @@ def route_eplan_connections_from_payload(doc, payload, options=None, prepared_la
|
|
|
|
}
|
|
|
|
}
|
|
|
|
result = create_route(
|
|
|
|
result = create_route(
|
|
|
|
route_lane_index,
|
|
|
|
route_lane_index,
|
|
|
|
item,
|
|
|
|
dict(item, __segment_usage_costs=segment_usage_costs),
|
|
|
|
start_terminal,
|
|
|
|
start_terminal,
|
|
|
|
end_terminal,
|
|
|
|
end_terminal,
|
|
|
|
endpoint_metadata,
|
|
|
|
endpoint_metadata,
|
|
|
|
@ -1507,7 +1514,7 @@ def route_eplan_connections_from_payload(doc, payload, options=None, prepared_la
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
result = create_route(
|
|
|
|
result = create_route(
|
|
|
|
final_lane_index,
|
|
|
|
final_lane_index,
|
|
|
|
item,
|
|
|
|
dict(item, __segment_usage_costs=segment_usage_costs),
|
|
|
|
start_terminal,
|
|
|
|
start_terminal,
|
|
|
|
end_terminal,
|
|
|
|
end_terminal,
|
|
|
|
endpoint_metadata,
|
|
|
|
endpoint_metadata,
|
|
|
|
@ -1548,6 +1555,7 @@ def route_eplan_connections_from_payload(doc, payload, options=None, prepared_la
|
|
|
|
lane_indexes_by_segment.get(segment_key, 0),
|
|
|
|
lane_indexes_by_segment.get(segment_key, 0),
|
|
|
|
int(result.get("lane", {}).get("index", 0) or 0) + 1,
|
|
|
|
int(result.get("lane", {}).get("index", 0) or 0) + 1,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
segment_usage_costs[segment_key] = segment_usage_costs.get(segment_key, 0) + 1
|
|
|
|
if result["route_status"] == "CollisionWarning":
|
|
|
|
if result["route_status"] == "CollisionWarning":
|
|
|
|
report["collision_warnings"] += 1
|
|
|
|
report["collision_warnings"] += 1
|
|
|
|
add_status(result["route_status"])
|
|
|
|
add_status(result["route_status"])
|
|
|
|
|