增加了 60 架飞机的mock 数据。
This commit is contained in:
parent
d02a6532ea
commit
b00190ee04
43
.gitignore
vendored
43
.gitignore
vendored
@ -54,4 +54,45 @@ logs/
|
||||
Users/
|
||||
|
||||
qaup-deploy/
|
||||
deploy/offline_packages/
|
||||
deploy/offline_packages/
|
||||
|
||||
######################################################################
|
||||
# Python
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
__pycache__/
|
||||
*.so
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
.venv/
|
||||
venv/
|
||||
ENV/
|
||||
env/
|
||||
*.log
|
||||
|
||||
######################################################################
|
||||
# Node.js
|
||||
node_modules/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.npm
|
||||
.yarn-integrity
|
||||
dist/
|
||||
.cache/
|
||||
@ -1,91 +0,0 @@
|
||||
# ============================================================
|
||||
# QAUP 生产环境配置
|
||||
# 关键配置项支持环境变量覆盖
|
||||
# 使用方式:创建 .env 文件,通过启动脚本加载环境变量
|
||||
# ============================================================
|
||||
|
||||
# 服务器配置
|
||||
server:
|
||||
port: ${SERVER_PORT:8080}
|
||||
servlet:
|
||||
context-path: /
|
||||
tomcat:
|
||||
uri-encoding: UTF-8
|
||||
accept-count: 1000
|
||||
threads:
|
||||
max: 800
|
||||
min-spare: 100
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
# Redis配置(支持环境变量)
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
database: ${REDIS_DATABASE:0}
|
||||
password: ${REDIS_PASSWORD:}
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
min-idle: 0
|
||||
max-idle: 8
|
||||
max-active: 8
|
||||
max-wait: -1ms
|
||||
|
||||
# Redis 内存优化配置(生产环境)
|
||||
redis:
|
||||
# 最大内存限制(生产环境建议1-2GB)
|
||||
max-memory: ${REDIS_MAX_MEMORY:1gb}
|
||||
# 内存淘汰策略
|
||||
max-memory-policy: ${REDIS_MAX_MEMORY_POLICY:volatile-lru}
|
||||
|
||||
# 日志配置(生产环境简洁日志)
|
||||
logging:
|
||||
level:
|
||||
com.qaup: ${LOG_LEVEL_QAUP:info}
|
||||
org.springframework: ${LOG_LEVEL_SPRING:warn}
|
||||
org.hibernate: warn
|
||||
com.alibaba.druid: warn
|
||||
pattern:
|
||||
console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n"
|
||||
|
||||
# 数据采集配置(支持环境变量)
|
||||
data:
|
||||
collector:
|
||||
interval: ${DATA_COLLECTOR_INTERVAL:250}
|
||||
detection:
|
||||
interval: ${DATA_DETECTION_INTERVAL:1000}
|
||||
|
||||
# 机场数据源配置(支持环境变量)
|
||||
airport-api:
|
||||
base-url: ${AIRPORT_API_BASE_URL:http://localhost:8090}
|
||||
auth:
|
||||
username: ${AIRPORT_API_USERNAME:dianxin}
|
||||
password: ${AIRPORT_API_PASSWORD:dianxin@123}
|
||||
|
||||
# 无人车厂商数据源配置(支持环境变量)
|
||||
vehicle-api:
|
||||
base-url: ${VEHICLE_API_BASE_URL:http://localhost:8091}
|
||||
timeout: ${VEHICLE_API_TIMEOUT:1000}
|
||||
retry-attempts: ${VEHICLE_API_RETRY:3}
|
||||
|
||||
# ADXP 适配器服务配置(生产环境)
|
||||
adxp-adapter:
|
||||
# 适配器主机地址
|
||||
host: ${ADXP_HOST:localhost}
|
||||
# 适配器端口
|
||||
port: ${ADXP_PORT:8086}
|
||||
# 登录用户名
|
||||
username: ${ADXP_USERNAME}
|
||||
# 登录密码
|
||||
password: ${ADXP_PASSWORD}
|
||||
# 重连延迟(毫秒)
|
||||
reconnect-delay-millis: ${RECONNECT_DELAY_MILLIS:3000}
|
||||
|
||||
# 红绿灯系统配置
|
||||
traffic:
|
||||
light:
|
||||
tcp:
|
||||
enabled: ${TRAFFIC_LIGHT_TCP_ENABLED:true}
|
||||
port: ${TRAFFIC_LIGHT_TCP_PORT:8082}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -5,6 +5,7 @@ import logging
|
||||
import os
|
||||
import threading
|
||||
import atexit
|
||||
import random
|
||||
from typing import Any, Literal, final, TypedDict
|
||||
|
||||
# 导入统一的日志配置
|
||||
@ -1702,6 +1703,83 @@ def initialize_aircraft_data():
|
||||
# 初始化飞机数据
|
||||
aircraft_data.extend(initialize_aircraft_data())
|
||||
|
||||
# 额外测试飞机数据(用于前端性能测试)
|
||||
additional_aircraft_data = []
|
||||
|
||||
def initialize_additional_aircraft():
|
||||
"""初始化 60 架测试飞机"""
|
||||
global additional_aircraft_data
|
||||
|
||||
# 机场中心坐标(基于 CGCS2000 投影坐标)
|
||||
airport_center_lat = 36.35406879
|
||||
airport_center_lon = 120.0834104
|
||||
|
||||
# 机场覆盖范围(大约 2km x 2km 区域)
|
||||
lat_range = 0.02 # 大约 2.2km
|
||||
lon_range = 0.02 # 大约 1.8km
|
||||
|
||||
# 创建 60 架测试飞机
|
||||
for i in range(1, 61):
|
||||
# 随机分布在机场范围内
|
||||
lat_offset = (random.random() - 0.5) * lat_range
|
||||
lon_offset = (random.random() - 0.5) * lon_range
|
||||
|
||||
aircraft_lat = airport_center_lat + lat_offset
|
||||
aircraft_lon = airport_center_lon + lon_offset
|
||||
|
||||
# 前 55 架静止,后 5 架移动
|
||||
is_moving = i > 55
|
||||
speed = random.uniform(20.0, 50.0) if is_moving else 0.0
|
||||
|
||||
# 为移动的飞机设置简单的往复移动路径
|
||||
if is_moving:
|
||||
# 在当前位置周围创建一个小范围的移动路径
|
||||
move_radius = 0.001 # 大约 100 米范围
|
||||
start_lat = aircraft_lat - move_radius
|
||||
start_lon = aircraft_lon - move_radius
|
||||
end_lat = aircraft_lat + move_radius
|
||||
end_lon = aircraft_lon + move_radius
|
||||
moving_to_end = True
|
||||
else:
|
||||
# 静止飞机使用当前位置作为起点和终点
|
||||
start_lat = aircraft_lat
|
||||
start_lon = aircraft_lon
|
||||
end_lat = aircraft_lat
|
||||
end_lon = aircraft_lon
|
||||
moving_to_end = False
|
||||
|
||||
aircraft = {
|
||||
"flightNo": f"PT{i:03d}", # 测试飞机航班号:PT001-PT060
|
||||
"longitude": aircraft_lon,
|
||||
"latitude": aircraft_lat,
|
||||
"time": int(time.time() * 1000),
|
||||
"altitude": 0.0,
|
||||
"trackNumber": 2000 + i, # 跟踪号:2001-2060
|
||||
"speed": speed,
|
||||
"use_route_following": False, # 不使用复杂路径跟随
|
||||
"start_point": {"latitude": start_lat, "longitude": start_lon},
|
||||
"end_point": {"latitude": end_lat, "longitude": end_lon},
|
||||
"moving_to_end": moving_to_end
|
||||
}
|
||||
|
||||
additional_aircraft_data.append(aircraft)
|
||||
|
||||
# 统计信息
|
||||
stationary_count = sum(1 for a in additional_aircraft_data if a["speed"] == 0)
|
||||
moving_count = len(additional_aircraft_data) - stationary_count
|
||||
|
||||
print(f"✅ 已添加测试飞机:")
|
||||
print(f" - 总飞机数: {len(additional_aircraft_data)}")
|
||||
print(f" - 静止飞机: {stationary_count} 架")
|
||||
print(f" - 移动飞机: {moving_count} 架")
|
||||
print(f" - 移动速度: 20-50 km/h")
|
||||
|
||||
# 添加到主飞机数据列表
|
||||
aircraft_data.extend(additional_aircraft_data)
|
||||
|
||||
# 初始化测试飞机
|
||||
initialize_additional_aircraft()
|
||||
|
||||
from collections.abc import Mapping
|
||||
|
||||
def calculate_distance_to_target(vehicle: Mapping[str, float], target_lat: float, target_lon: float) -> float:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user