RAILWISE-TSM全站仪自动化AI工具
RAILWISE-TSM是RailWise的全站仪自动化监测平台,基于Next.js/NestJS/Rust/WASM技术栈构建。本文档介绍其AI工具模块的功能、API接口和使用方法,实现全站仪的智能化自动化监测。
RAILWISE-TSM全站仪自动化AI工具
Section titled “RAILWISE-TSM全站仪自动化AI工具”RAILWISE-TSM(Total Station Monitoring)是 RailWise 推出的 全站仪自动化监测平台,专为轨道交通、桥梁、基坑等工程监测场景设计。平台基于 Next.js(前端)、NestJS(后端)、Rust/WASM(核心计算)技术栈构建,集成了AI驱动的自动化测量、实时分析和智能预警功能。
| 场景 | 说明 | 典型项目 |
|---|---|---|
| 盾构施工监测 | 盾构侧穿期间的桥墩、建筑物变形监测 | 轨道交通3号线控制保护区 |
| 桥梁健康监测 | 桥梁结构位移、沉降、应力长期监测 | 高架桥健康监测 |
| 基坑工程监测 | 基坑周边建筑物、地下管线变形监测 | 深基坑工程 |
| 隧道收敛监测 | 隧道断面收敛、地表沉降监测 | 山岭隧道/城市隧道 |
| 高边坡监测 | 边坡位移、深层水平位移监测 | 路基高边坡 |
| 项目 | 版本 | 技术栈 |
|---|---|---|
| RAILWISE-TSM | 3.1.0 | - |
| 前端 | 3.1.0 | Next.js 14, React 18, TypeScript |
| 后端 | 3.1.0 | NestJS 10, Node.js 20 |
| 核心计算 | 3.1.0 | Rust 1.78, WASM |
| AI引擎 | 2.0 | ONNX Runtime |
┌─────────────────────────────────────────────────────────────────────┐│ RAILWISE-TSM 架构 │├─────────────────────────────────────────────────────────────────────┤│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ││ │ Web 前端 │ │ 桌面客户端 │ │ CLI工具 │ ││ │ (Next.js) │ │ (Electron) │ │ (RAILWISE-CLI)│ ││ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ ││ │ │ │ ││ └──────────────────┼──────────────────┘ ││ ▼ ││ ┌──────────────────────────────┐ ││ │ API Gateway (NestJS) │ ││ │ REST API / WebSocket / gRPC │ ││ └──────────────┬───────────────┘ ││ │ ││ ┌───────────────────┼───────────────────┐ ││ ▼ ▼ ▼ ││ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ││ │ 业务服务层 │ │ AI服务层 │ │ 设备服务层 │ ││ │ - 项目管理 │ │ - 数据分析 │ │ - 全站仪控制 │ ││ │ - 测点管理 │ │ - 异常检测 │ │ - 传感器接入 │ ││ │ - 数据管理 │ │ - 趋势预测 │ │ - 数据采集 │ ││ │ - 报告管理 │ │ - 预警判定 │ │ - 设备状态 │ ││ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ ││ │ │ │ ││ └──────────────────┼──────────────────┘ ││ ▼ ││ ┌──────────────────────────────┐ ││ │ Rust/WASM 核心计算引擎 │ ││ │ - 坐标计算 - 平差处理 │ ││ │ - 矩阵运算 - 统计推断 │ ││ │ - 模型推理 - 数据压缩 │ ││ └──────────────┬───────────────┘ ││ │ ││ ┌──────────────┴───────────────┐ ││ │ 数据持久化层 │ ││ │ PostgreSQL + Redis + MinIO │ ││ └──────────────────────────────┘ │└─────────────────────────────────────────────────────────────────────┘AI工具模块
Section titled “AI工具模块”RAILWISE-TSM 的 AI 工具模块包含以下核心组件:
1. 智能测量调度器(Smart Survey Scheduler)
Section titled “1. 智能测量调度器(Smart Survey Scheduler)”基于项目状态、天气条件、设备状态和历史数据,智能优化测量计划。
核心功能:
- 动态调整测量频率(正常/加密/特密)
- 避开恶劣天气窗口
- 设备负载均衡
- 优先级队列管理
配置示例:
{ "scheduler": { "mode": "adaptive", "base_interval": 300, "rules": [ { "condition": "alert_level == 'red'", "action": "set_interval", "value": 60 }, { "condition": "alert_level == 'orange'", "action": "set_interval", "value": 120 }, { "condition": "weather.wind_speed > 15", "action": "pause", "duration": 3600 } ] }}2. 数据质量评估器(Data Quality Assessor)
Section titled “2. 数据质量评估器(Data Quality Assessor)”实时评估测量数据质量,自动识别可疑数据并触发复测。
评估维度:
| 维度 | 指标 | 阈值 |
|---|---|---|
| 精度 | 测回差、半测回差 | ≤ 2.0mm |
| 稳定性 | 相邻测次变化量 | ≤ 3.0mm |
| 一致性 | 与历史趋势一致性 | 95%置信区间 |
| 完整性 | 数据缺失率 | ≤ 5% |
API调用:
import { TSMClient } from '@railwise/tsm-sdk';
const client = new TSMClient({ baseURL: 'https://tsm.railwise.cn', apiKey: 'rw_tsm_xxxxxxxx'});
// 评估单次测量数据质量const quality = await client.ai.assessQuality({ projectId: 'proj_rw_2026_001', surveyId: 'survey_20260708_001', metrics: ['precision', 'stability', 'consistency', 'completeness']});
console.log(quality.score); // 0-100 质量评分console.log(quality.issues); // 发现的问题列表3. 变形趋势预测器(Deformation Forecaster)
Section titled “3. 变形趋势预测器(Deformation Forecaster)”基于时间序列模型预测测点未来的变形趋势。
支持的模型:
| 模型 | 适用场景 | 预测 horizon |
|---|---|---|
| ARIMA | 线性趋势 | 1-7天 |
| Prophet | 周期性变化 | 1-30天 |
| LSTM | 复杂非线性 | 1-7天 |
| 灰色模型 | 小样本 | 1-3天 |
API调用:
// 获取变形预测const forecast = await client.ai.forecast({ projectId: 'proj_rw_2026_001', pointIds: ['P1', 'P2', 'P3'], horizon: 72, // 预测未来72小时 model: 'prophet', confidence: 0.95});
// 预测结果forecast.results.forEach(result => { console.log(`测点 ${result.pointId}:`); console.log(` 预测值: ${result.predictedValue.toFixed(2)} mm`); console.log(` 置信区间: [${result.lowerBound.toFixed(2)}, ${result.upperBound.toFixed(2)}] mm`); console.log(` 预警概率: ${(result.alertProbability * 100).toFixed(1)}%`);});4. 异常检测引擎(Anomaly Detection Engine)
Section titled “4. 异常检测引擎(Anomaly Detection Engine)”基于统计学和机器学习算法,自动检测数据异常。
算法库:
| 算法 | 类型 | 适用场景 |
|---|---|---|
| 3σ准则 | 统计 | 单点异常 |
| Grubbs检验 | 统计 | 离群值检测 |
| Isolation Forest | 机器学习 | 多维异常 |
| LOF | 机器学习 | 局部异常 |
| Autoencoder | 深度学习 | 复杂模式异常 |
API调用:
// 执行异常检测const anomalies = await client.ai.detectAnomalies({ projectId: 'proj_rw_2026_001', pointIds: ['all'], startDate: '2026-07-01', endDate: '2026-07-08', algorithms: ['isolation_forest', 'grubbs'], sensitivity: 'high'});
// 处理异常结果anomalies.forEach(anomaly => { if (anomaly.severity === 'critical') { console.warn(`严重异常: 测点 ${anomaly.pointId} 于 ${anomaly.timestamp}`); console.warn(` 异常值: ${anomaly.value} mm (预期范围: ${anomaly.expectedRange})`); console.warn(` 建议操作: ${anomaly.recommendedAction}`); }});5. 智能预警判定器(Smart Alert Classifier)
Section titled “5. 智能预警判定器(Smart Alert Classifier)”根据监测规范和项目特点,自动判定预警等级。
预警等级:
| 等级 | 颜色 | 判定条件 | 响应措施 |
|---|---|---|---|
| 正常 | 绿色 | 累计变形 < 黄色阈值×60% | 常规监测 |
| 注意 | 蓝色 | 累计变形 ≥ 黄色阈值×60% | 加密监测 |
| 黄色预警 | 黄色 | 累计变形 ≥ 黄色阈值 | 加密监测,分析原因 |
| 橙色预警 | 橙色 | 累计变形 ≥ 橙色阈值 | 特密监测,专家会商 |
| 红色预警 | 红色 | 累计变形 ≥ 红色阈值 | 停工,应急措施 |
API调用:
// 获取预警状态const alerts = await client.ai.getAlertStatus({ projectId: 'proj_rw_2026_001', includeHistory: true, includeRecommendations: true});
// 预警统计console.log(`总测点数: ${alerts.totalPoints}`);console.log(`正常: ${alerts.normalCount}`);console.log(`注意: ${alerts.noticeCount}`);console.log(`黄色预警: ${alerts.yellowCount}`);console.log(`橙色预警: ${alerts.orangeCount}`);console.log(`红色预警: ${alerts.redCount}`);RAILWISE-TSM API 使用 API Key 进行认证。
获取 API Key:
- 登录 RAILWISE-TSM 平台
- 进入
设置 → API访问 → 生成密钥 - 复制生成的 API Key
请求头格式:
Authorization: Bearer rw_tsm_xxxxxxxxxxxxxxxxContent-Type: application/jsonX-API-Version: v2| 项目 | 值 |
|---|---|
| Base URL | https://tsm.railwise.cn/api/v2 |
| 协议 | HTTPS |
| 数据格式 | JSON |
| 字符编码 | UTF-8 |
AI测量调度
Section titled “AI测量调度”POST /ai/scheduler/optimize优化测量调度计划。
请求参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| projectId | string | 是 | 项目ID |
| constraints | object | 否 | 约束条件 |
| constraints.timeWindow | string | 否 | 时间窗口,如 “06:00-22:00” |
| constraints.maxPointsPerBatch | integer | 否 | 每批最大测点数 |
| constraints.weatherCheck | boolean | 否 | 是否检查天气 |
请求示例:
curl -X POST https://tsm.railwise.cn/api/v2/ai/scheduler/optimize \ -H "Authorization: Bearer rw_tsm_xxxxxxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "projectId": "proj_rw_2026_001", "constraints": { "timeWindow": "06:00-22:00", "maxPointsPerBatch": 50, "weatherCheck": true } }'响应示例:
{ "success": true, "data": { "schedule": { "batches": [ { "batchId": "batch_001", "startTime": "2026-07-08T06:00:00+08:00", "estimatedDuration": 1800, "points": ["P1", "P2", "P3", "P4", "P5"], "priority": "high" } ], "totalDuration": 7200, "optimizationScore": 95.5 } }}数据质量评估
Section titled “数据质量评估”POST /ai/quality/assess评估测量数据质量。
请求参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| projectId | string | 是 | 项目ID |
| surveyId | string | 是 | 测量批次ID |
| metrics | array | 否 | 评估维度,默认全部 |
响应示例:
{ "success": true, "data": { "quality": { "score": 92.5, "grade": "A", "dimensions": { "precision": { "score": 95.0, "status": "excellent" }, "stability": { "score": 88.0, "status": "good" }, "consistency": { "score": 94.0, "status": "excellent" }, "completeness": { "score": 93.0, "status": "excellent" } }, "issues": [ { "type": "stability", "severity": "minor", "description": "P3测点相邻测次变化量偏大", "recommendedAction": "建议增加测回数或检查仪器稳定性" } ] } }}POST /ai/forecast预测测点变形趋势。
请求参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| projectId | string | 是 | 项目ID |
| pointIds | array | 是 | 测点ID列表,[“all”]表示全部 |
| horizon | integer | 是 | 预测时长(小时) |
| model | string | 否 | 预测模型,默认 auto |
| confidence | number | 否 | 置信水平,默认 0.95 |
响应示例:
{ "success": true, "data": { "forecast": { "model": "prophet", "generatedAt": "2026-07-08T14:00:00+08:00", "results": [ { "pointId": "P1", "predictions": [ { "timestamp": "2026-07-08T20:00:00+08:00", "predictedValue": 12.35, "lowerBound": 10.20, "upperBound": 14.50, "alertProbability": 0.05 } ], "trend": "increasing", "trendRate": 0.5 } ] } }}POST /ai/anomalies/detect检测数据异常。
请求参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| projectId | string | 是 | 项目ID |
| pointIds | array | 是 | 测点ID列表 |
| startDate | string | 是 | 开始日期,ISO 8601 |
| endDate | string | 是 | 结束日期,ISO 8601 |
| algorithms | array | 否 | 检测算法 |
| sensitivity | string | 否 | 灵敏度:low/medium/high |
响应示例:
{ "success": true, "data": { "anomalies": [ { "id": "anomaly_001", "pointId": "P3", "timestamp": "2026-07-07T08:00:00+08:00", "type": "spike", "severity": "critical", "value": 25.8, "expectedRange": [8.0, 15.0], "algorithms": ["isolation_forest", "grubbs"], "recommendedAction": "立即复测,检查测点及周边环境" } ], "summary": { "total": 1, "critical": 1, "warning": 0, "info": 0 } }}GET /ai/alerts/status?projectId={projectId}获取项目预警状态。
响应示例:
{ "success": true, "data": { "status": { "totalPoints": 25, "normalCount": 18, "noticeCount": 3, "yellowCount": 2, "orangeCount": 1, "redCount": 1, "alertPoints": [ { "pointId": "P7", "level": "red", "currentValue": 18.5, "threshold": 15.0, "exceededRatio": 1.23, "lastUpdated": "2026-07-08T12:00:00+08:00" } ] } }}| 错误码 | 说明 | 处理建议 |
|---|---|---|
| 400 | 请求参数错误 | 检查请求体格式和参数 |
| 401 | 认证失败 | 检查 API Key 是否有效 |
| 403 | 权限不足 | 确认账号有权限访问该项目 |
| 404 | 资源不存在 | 检查 projectId 或 pointId |
| 429 | 请求过于频繁 | 降低请求频率,查看速率限制 |
| 500 | 服务器内部错误 | 稍后重试,联系技术支持 |
| 503 | 服务暂时不可用 | AI服务维护中,稍后重试 |
| 端点类型 | 限制 | 说明 |
|---|---|---|
| 常规查询 | 100次/分钟 | 数据查询类接口 |
| AI计算 | 20次/分钟 | 涉及模型推理的接口 |
| 批量操作 | 10次/分钟 | 大批量数据处理 |
Rust/WASM核心模块
Section titled “Rust/WASM核心模块”RAILWISE-TSM 的核心计算逻辑使用 Rust 编写,编译为 WASM 在浏览器和 Node.js 环境中运行。
WASM模块列表
Section titled “WASM模块列表”| 模块 | 功能 | 输入 | 输出 |
|---|---|---|---|
coordinate.wasm |
坐标计算 | 观测值、仪器参数 | 三维坐标 |
adjustment.wasm |
平差计算 | 观测网、权矩阵 | 平差结果、精度评定 |
statistics.wasm |
统计分析 | 时间序列 | 统计量、趋势参数 |
forecast.wasm |
趋势预测 | 历史数据、预测参数 | 预测值、置信区间 |
anomaly.wasm |
异常检测 | 数据集、算法参数 | 异常标记、置信度 |
在浏览器中使用WASM
Section titled “在浏览器中使用WASM”import { initTSMEngine, CoordinateCalculator } from '@railwise/tsm-wasm';
// 初始化 WASM 引擎await initTSMEngine();
// 坐标计算const calculator = new CoordinateCalculator();const result = calculator.calculateCoordinates({ station: { x: 1000.0, y: 2000.0, z: 50.0 }, observations: [ { pointId: 'P1', horizontalAngle: 120.5, verticalAngle: 85.2, slopeDistance: 150.3 }, { pointId: 'P2', horizontalAngle: 135.8, verticalAngle: 88.1, slopeDistance: 200.7 } ], instrumentHeight: 1.5, prismHeight: 0.3});
console.log(result.coordinates);// [// { pointId: 'P1', x: 1075.23, y: 2129.87, z: 62.45 },// { pointId: 'P2', x: 1142.56, y: 2143.21, z: 58.32 }// ]在Node.js中使用WASM
Section titled “在Node.js中使用WASM”import { createTSMEngine } from '@railwise/tsm-wasm/node';
const engine = await createTSMEngine();
// 批量平差计算const adjustment = await engine.adjustment.networkAdjustment({ observations: [...], // 观测数据 knownPoints: [...], // 已知控制点 unknownPoints: [...], // 待求点 weights: [...] // 权矩阵});
console.log(adjustment.coordinates);console.log(adjustment.precision);console.log(adjustment.residuals);自动化监测工作流
Section titled “自动化监测工作流”标准工作流定义
Section titled “标准工作流定义”name: standard_monitoringversion: "3.1"description: 标准自动化监测工作流
project: id: "proj_rw_2026_001" name: "绕城高速管廊工程1标段"
triggers: - type: schedule cron: "0 */4 * * *" # 每4小时 - type: alert condition: "alert_level in ['orange', 'red']" action: "trigger_immediate"
steps: - id: check_weather name: "天气检查" action: ai.checkWeather params: location: "121.56,29.83" maxWindSpeed: 15
- id: survey name: "自动化测量" action: survey.execute depends_on: [check_weather] condition: "check_weather.isSuitable == true" params: station: "TS-01" points: "all" rounds: 3 autoRetry: true
- id: quality_check name: "质量检查" action: ai.assessQuality depends_on: [survey] params: autoRetryOnFailure: true maxRetryAttempts: 2
- id: analyze name: "数据分析" action: ai.analyze depends_on: [quality_check] params: detectAnomalies: true forecastHorizon: 72 updateAlertStatus: true
- id: report name: "报告生成" action: report.generate depends_on: [analyze] condition: "analyze.hasAlert == true or schedule.isScheduledReportTime" params: template: "gb50911-2013" format: "pdf" distribute: true
- id: alert name: "预警通知" action: notification.send depends_on: [analyze] condition: "analyze.maxAlertLevel in ['yellow', 'orange', 'red']" params: channels: ["email", "sms", "app"] template: "alert_{{maxAlertLevel}}"# 通过 CLI 执行工作流railwise-cli workflow run --file tsm_workflow_standard.yaml
# 通过 API 执行工作流curl -X POST https://tsm.railwise.cn/api/v2/workflows/execute \ -H "Authorization: Bearer rw_tsm_xxxxxxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "workflowFile": "tsm_workflow_standard.yaml", "projectId": "proj_rw_2026_001" }'与RAILWISE-CLI集成
Section titled “与RAILWISE-CLI集成”RAILWISE-TSM 与 RAILWISE-CLI 通过 API 和 WebSocket 双向集成。
CLI调用TSM AI功能
Section titled “CLI调用TSM AI功能”# 使用 TSM AI 进行数据分析railwise-cli analyze trend \ --provider tsm \ --project "proj_rw_2026_001" \ --tsm-url "https://tsm.railwise.cn" \ --tsm-key "rw_tsm_xxxxxxxx"
# 使用 TSM 生成预测railwise-cli analyze forecast \ --provider tsm \ --project "proj_rw_2026_001" \ --horizon 72TSM调用CLI功能
Section titled “TSM调用CLI功能”// 在 TSM 后端服务中调用 CLIimport { CLIClient } from '@railwise/tsm-cli-bridge';
const cli = new CLIClient({ cliPath: '/usr/local/bin/railwise-cli', workspace: '/data/railwise/projects'});
// 执行本地测量(通过 CLI 直连设备)const result = await cli.execute('survey', 'execute', { station: 'TS-01', points: ['P1', 'P2', 'P3'], rounds: 3});
// 结果自动同步回 TSMawait tsmClient.data.uploadSurveyResult({ projectId: 'proj_rw_2026_001', data: result});1. AI模型选择
Section titled “1. AI模型选择”| 场景 | 推荐模型 | 说明 |
|---|---|---|
| 短期预测(1-3天) | ARIMA | 计算快,适合线性趋势 |
| 中期预测(3-14天) | Prophet | 支持周期性,可解释性强 |
| 复杂非线性趋势 | LSTM | 精度高,但需要更多数据 |
| 数据量小(<30天) | 灰色模型 | 小样本友好 |
| 实时异常检测 | Isolation Forest | 快速,无需训练 |
2. 参数调优
Section titled “2. 参数调优”// 预测参数调优const forecastConfig = { horizon: 72, // 预测72小时 confidence: 0.95, // 95%置信区间 minDataPoints: 168, // 至少7天数据(每小时1个) outlierRemoval: true, // 预测前去除异常值 seasonalPeriods: [24, 168], // 日周期、周周期 changepointPriorScale: 0.05 // 趋势变化灵敏度};
// 异常检测参数调优const anomalyConfig = { algorithms: ['isolation_forest'], contamination: 0.02, // 预期异常比例 2% sensitivity: 'high', windowSize: 24, // 滑动窗口24小时 minAnomalyDuration: 2 // 至少连续2个异常点才报警};3. 性能优化
Section titled “3. 性能优化”- 使用 WASM 本地计算减少网络延迟
- 批量请求替代单个请求
- 合理设置缓存策略
- 预测结果缓存,避免重复计算
限制与注意事项
Section titled “限制与注意事项”| 限制项 | 说明 |
|---|---|
| 预测数据量 | 至少需要7天历史数据 |
| 预测时长 | 建议不超过30天 |
| 并发AI请求 | 每项目最多5个并发 |
| WASM兼容性 | 需要支持WebAssembly的浏览器 |
| 模型更新 | AI模型每月更新一次 |
| 精度保证 | 预测精度受数据质量影响 |
注意: AI预测结果仅供参考,不能替代工程师的专业判断。关键决策仍需人工审核。
Q1: 预测结果不准确怎么办?
Section titled “Q1: 预测结果不准确怎么办?”- 检查历史数据质量,去除异常值
- 增加历史数据量(建议至少30天)
- 尝试不同的预测模型
- 调整模型参数(如季节性周期)
Q2: 异常检测误报太多?
Section titled “Q2: 异常检测误报太多?”- 降低灵敏度设置
- 调整
contamination参数 - 增加
minAnomalyDuration - 使用多种算法交叉验证
Q3: WASM模块加载失败?
Section titled “Q3: WASM模块加载失败?”- 检查浏览器是否支持 WebAssembly
- 确认 WASM 文件路径正确
- 检查 CORS 配置
- 尝试使用 Node.js 版本
Q4: API返回503错误?
Section titled “Q4: API返回503错误?”AI服务可能正在维护或负载过高:
- 稍后重试(建议间隔30秒)
- 检查 RailWise状态页面
- 联系技术支持确认服务状态
| 版本 | 日期 | 变更内容 |
|---|---|---|
| 3.1.0 | 2026-07-08 | 新增Prophet预测模型;优化异常检测算法;WASM模块性能提升30% |
| 3.0.0 | 2026-04-20 | 全新AI引擎;支持LSTM预测;新增数据质量评估器 |
| 2.5.0 | 2026-01-15 | 新增智能调度器;支持天气联动;优化预警判定 |
| 2.0.0 | 2025-09-10 | 初始AI功能发布;支持ARIMA预测和Isolation Forest异常检测 |
技术支持: 如有疑问,请联系 RailWise 技术支持团队
- 邮箱:support@railwise.cn
- 电话:0574-XXXXXXXX
- 文档反馈:GitHub Issues
