高精度轨道预报器
2026/1/21大约 4 分钟
高精度轨道预报器
概述
高精度轨道预报器 (High Precision Orbit Propagator, HPOP) 是基于数值积分的高精度轨道预报系统,采用模块化设计思想,支持多种摄动力模型的精确模拟。该系统参考Simulink的仿真思想,将复杂的轨道动力学系统分解为多个功能模块的组合。
核心概念
模块化设计
参考Simulink的仿真思想,HPOP采用函数块(Function Block)架构,将轨道动力学系统分解为多个功能模块的组合。
每个函数块可以是普通函数块或导数函数块,负责计算系统的一个子问题,例如计算动力学系统中一个或多个状态量或者其导数。
不同函数块之间通过输入输出端口进行信号连接,组合得到一个动力学系统。
主要特点包括:
- 功能模块化:将复杂系统分解为多个独立的功能模块
- 数据共享:通过函数块之间的信号连接实现数据共享,减少重复计算
- 灵活组合:可灵活组合不同函数块,形成定制化的仿真模型
力模型配置
HPOP支持多种摄动力模型的精确模拟:
- 中心天体重力场:可配置阶数和次数的球谐函数模型
- 大气阻力:考虑大气密度变化的阻力模型
- 太阳辐射压:太阳光压对航天器的影响
- 三体引力:月球、太阳等第三体引力摄动
- 相对论效应:相对论修正
主要接口
类接口
class AST_CORE_API HPOP主要方法:
// 设置力模型
errc_t setForceModel(const HPOPForceModel& forcemodel);
// 设置积分器
void setIntegrator(ODEIntegrator* integrator);
// 轨道预报
errc_t propagate(const TimePoint& start, const TimePoint& end, Vector3d& position, Vector3d& velocity);
// 初始化
errc_t initialize();力模型配置结构
struct HPOPForceModel
{
bool useDrag_{false}; // 是否使用阻力模型
bool useSRP_{false}; // 是否使用太阳辐射压模型
bool useMoonGravity_{false}; // 是否使用月球引力
Gravity gravity_; // 中心天体重力场配置
// ... 其他力模型配置
};用法示例
1. 基本轨道预报
#include "AstCore/HPOP.hpp"
#include "AstCore/HPOPForceModel.hpp"
#include "AstCore/TimePoint.hpp"
#include "AstCore/RunTime.hpp"
#include "AstMath/Vector.hpp"
#include "AstUtil/Literals.hpp"
#include "AstUtil/Constants.h"
#include <iostream>
#include <iomanip>
AST_USING_NAMESPACE
using namespace _AST literals;
int main()
{
// 初始化运行时环境
aInitialize();
setlocale(LC_ALL, ".UTF-8");
std::cout << std::fixed << std::setprecision(3);
std::cout << "HPOP高精度轨道预报器 - 基本使用示例" << std::endl;
std::cout << "====================================" << std::endl;
// 创建HPOP对象
HPOP hpop;
// 配置基本力模型 (仅使用JGM3地球重力场J2项)
HPOPForceModel force_model;
force_model.gravity_.model_ = "JGM3"; // 使用JGM3重力场模型
force_model.gravity_.maxDegree_ = 2; // 阶数
force_model.gravity_.maxOrder_ = 0; // 次数
// 设置力模型
errc_t result = hpop.setForceModel(force_model);
if (result != eNoError) {
std::cout << "设置力模型失败,错误码: " << result << std::endl;
return -1;
}
// 初始化HPOP
result = hpop.initialize();
if (result != eNoError) {
std::cout << "初始化失败,错误码: " << result << std::endl;
return -1;
}
std::cout << "HPOP初始化成功" << std::endl;
std::cout << "力模型配置: " << force_model.gravity_.model_ << " (阶数="
<< force_model.gravity_.maxDegree_ << ", 次数=" << force_model.gravity_.maxOrder_ << ")" << std::endl;
std::cout << std::endl;
// 设置初始轨道状态 (近地轨道)
TimePoint start_time = TimePoint::FromUTC(2026, 1, 1, 0, 0, 0);
Vector3d position{7000_km, 0.0, 0.0};
Vector3d velocity{0.0, 7.5_km_s, 1.0_km_s};
std::cout << "初始轨道状态:" << std::endl;
std::cout << "起始时间: 2026-01-01 00:00:00 UTC" << std::endl;
std::cout << "位置: (" << position[0]/1000.0 << ", "
<< position[1]/1000.0 << ", "
<< position[2]/1000.0 << ") km" << std::endl;
std::cout << "速度: (" << velocity[0]/1000.0 << ", "
<< velocity[1]/1000.0 << ", "
<< velocity[2]/1000.0 << ") km/s" << std::endl;
std::cout << std::endl;
// 设置传播时间 (1天)
TimePoint end_time = start_time + 24 * 3600.0; // 加1天
// 执行轨道预报
result = hpop.propagate(start_time, end_time, position, velocity);
if (result == eNoError) {
std::cout << "轨道预报成功" << std::endl;
std::cout << "结束时间: 2026-01-02 00:00:00 UTC" << std::endl;
std::cout << "预报后位置: (" << position[0]/1000.0 << ", "
<< position[1]/1000.0 << ", "
<< position[2]/1000.0 << ") km" << std::endl;
std::cout << "预报后速度: (" << velocity[0]/1000.0 << ", "
<< velocity[1]/1000.0 << ", "
<< velocity[2]/1000.0 << ") km/s" << std::endl;
// 计算轨道参数
double radius = position.norm() / 1000.0; // km
double speed = velocity.norm() / 1000.0; // km/s
std::cout << std::endl;
std::cout << "轨道参数:" << std::endl;
std::cout << "轨道半径: " << radius << " km" << std::endl;
std::cout << "轨道速度: " << speed << " km/s" << std::endl;
} else {
std::cout << "轨道预报失败,错误码: " << result << std::endl;
}
return 0;
}2. 高级力模型配置
#include "AstCore/HPOP.hpp"
#include "AstCore/HPOPForceModel.hpp"
#include "AstCore/TimePoint.hpp"
#include "AstCore/RunTime.hpp"
#include "AstMath/Vector.hpp"
#include "AstUtil/Literals.hpp"
#include "AstUtil/Constants.h"
#include <iostream>
#include <iomanip>
#include <cmath>
AST_USING_NAMESPACE
using namespace _AST literals;
int main()
{
// 初始化运行时环境
aInitialize();
setlocale(LC_ALL, ".UTF-8");
std::cout << std::fixed << std::setprecision(3);
std::cout << "HPOP高精度轨道预报器 - 高级力模型配置示例" << std::endl;
std::cout << "==========================================" << std::endl;
// 创建HPOP对象
HPOP hpop;
// 配置高级力模型
HPOPForceModel force_model;
// 1. 配置地球重力场 (JGM3模型)
force_model.gravity_.model_ = "JGM3"; // 使用JGM3重力场模型
force_model.gravity_.maxDegree_ = 4; // 阶数
force_model.gravity_.maxOrder_ = 0; // 次数
// 2. 配置大气阻力模型
force_model.useDrag_ = true; // 启用大气阻力
// 3. 配置第三体引力 (太阳和月球)
force_model.useMoonGravity_ = true; // 启用月球引力
// 设置力模型
errc_t result = hpop.setForceModel(force_model);
if (result != eNoError) {
std::cout << "设置力模型失败,错误码: " << result << std::endl;
return -1;
}
// 初始化HPOP
result = hpop.initialize();
if (result != eNoError) {
std::cout << "初始化失败,错误码: " << result << std::endl;
return -1;
}
std::cout << "HPOP初始化成功" << std::endl;
std::cout << "力模型配置:" << std::endl;
std::cout << "- 重力场: " << force_model.gravity_.model_
<< " (阶数=" << force_model.gravity_.maxDegree_ << ", 次数=" << force_model.gravity_.maxOrder_ << ")" << std::endl;
std::cout << "- 大气阻力: " << (force_model.useDrag_ ? "启用" : "禁用") << std::endl;
std::cout << "- 月球引力: " << (force_model.useMoonGravity_ ? "启用" : "禁用") << std::endl;
std::cout << std::endl;
// 设置初始轨道状态 (低地球轨道)
TimePoint start_time = TimePoint::FromUTC(2026, 1, 1, 0, 0, 0);
Vector3d position{6878.14_km, 0.0, 0.0}; // 约400km高度
Vector3d velocity{0.0, 7.668_km_s, 0.0}; // 圆轨道速度
std::cout << "初始轨道状态:" << std::endl;
std::cout << "起始时间: 2026-01-01 00:00:00 UTC" << std::endl;
std::cout << "位置: (" << position[0]/1000.0 << ", "
<< position[1]/1000.0 << ", "
<< position[2]/1000.0 << ") km" << std::endl;
std::cout << "速度: (" << velocity[0]/1000.0 << ", "
<< velocity[1]/1000.0 << ", "
<< velocity[2]/1000.0 << ") km/s" << std::endl;
std::cout << std::endl;
// 设置传播时间 (3天)
TimePoint end_time = start_time + 3 * 24 * 3600.0; // 加3天
// 执行轨道预报
result = hpop.propagate(start_time, end_time, position, velocity);
if (result == eNoError) {
std::cout << "轨道预报成功" << std::endl;
std::cout << "传播时长: 3天" << std::endl;
std::cout << "结束时间: 2026-01-04 00:00:00 UTC" << std::endl;
std::cout << "预报后位置: (" << position[0]/1000.0 << ", "
<< position[1]/1000.0 << ", "
<< position[2]/1000.0 << ") km" << std::endl;
std::cout << "预报后速度: (" << velocity[0]/1000.0 << ", "
<< velocity[1]/1000.0 << ", "
<< velocity[2]/1000.0 << ") km/s" << std::endl;
// 计算轨道参数变化
double initial_radius = 6878.14; // km
double final_radius = position.norm() / 1000.0; // km
double radius_change = final_radius - initial_radius;
std::cout << std::endl;
std::cout << "轨道参数变化:" << std::endl;
std::cout << "初始轨道半径: " << initial_radius << " km" << std::endl;
std::cout << "最终轨道半径: " << final_radius << " km" << std::endl;
std::cout << "轨道半径变化: " << radius_change << " km" << std::endl;
} else {
std::cout << "轨道预报失败,错误码: " << result << std::endl;
}
return 0;
}3. 多天轨道预报
#include "AstCore/HPOP.hpp"
#include "AstCore/HPOPForceModel.hpp"
#include "AstCore/TimePoint.hpp"
#include "AstCore/RunTime.hpp"
#include "AstMath/Vector.hpp"
#include "AstUtil/Literals.hpp"
#include "AstUtil/Constants.h"
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
AST_USING_NAMESPACE
using namespace _AST literals;
int main()
{
// 初始化运行时环境
aInitialize();
setlocale(LC_ALL, ".UTF-8");
std::cout << std::fixed << std::setprecision(3);
std::cout << "HPOP高精度轨道预报器 - 多天传播示例" << std::endl;
std::cout << "====================================" << std::endl;
// 创建HPOP对象
HPOP hpop;
// 配置高精度力模型
HPOPForceModel force_model;
// 配置地球重力场 (使用高精度模型)
force_model.gravity_.model_ = "EGM2008"; // 使用高精度重力场模型
force_model.gravity_.maxDegree_ = 8; // 阶数
force_model.gravity_.maxOrder_ = 8; // 次数
// 配置大气阻力模型
force_model.useDrag_ = true; // 启用大气阻力
// 配置第三体引力
force_model.useMoonGravity_ = true; // 启用月球引力
// 设置力模型
errc_t result = hpop.setForceModel(force_model);
if (result != eNoError) {
std::cout << "设置力模型失败,错误码: " << result << std::endl;
return -1;
}
// 初始化HPOP
result = hpop.initialize();
if (result != eNoError) {
std::cout << "初始化失败,错误码: " << result << std::endl;
return -1;
}
std::cout << "HPOP初始化成功" << std::endl;
std::cout << "力模型配置:" << std::endl;
std::cout << "- 重力场: " << force_model.gravity_.model_
<< " (阶数=" << force_model.gravity_.maxDegree_
<< ", 次数=" << force_model.gravity_.maxOrder_ << ")" << std::endl;
std::cout << "- 大气阻力: " << (force_model.useDrag_ ? "启用" : "禁用") << std::endl;
std::cout << "- 月球引力: " << (force_model.useMoonGravity_ ? "启用" : "禁用") << std::endl;
std::cout << std::endl;
// 设置初始轨道状态 (中地球轨道 - 导航卫星轨道)
TimePoint start_time = TimePoint::FromUTC(2026, 1, 1, 0, 0, 0);
Vector3d position{26560_km, 0.0, 0.0}; // 约20000km高度
Vector3d velocity{0.0, 3.87_km_s, 0.0}; // 圆轨道速度
std::cout << "初始轨道状态:" << std::endl;
std::cout << "起始时间: 2026-01-01 00:00:00 UTC" << std::endl;
std::cout << "位置: (" << position[0]/1000.0 << ", "
<< position[1]/1000.0 << ", "
<< position[2]/1000.0 << ") km" << std::endl;
std::cout << "速度: (" << velocity[0]/1000.0 << ", "
<< velocity[1]/1000.0 << ", "
<< velocity[2]/1000.0 << ") km/s" << std::endl;
std::cout << std::endl;
// 定义多个传播时间点
std::vector<double> propagation_days = {1.0, 7.0, 30.0, 90.0}; // 1天, 7天, 30天, 90天
std::cout << "多时间点轨道预报结果:" << std::endl;
std::cout << "=====================" << std::endl;
// 保存初始状态用于比较
Vector3d initial_position = position;
Vector3d initial_velocity = velocity;
for (double days : propagation_days) {
// 重置到初始状态
position = initial_position;
velocity = initial_velocity;
// 设置传播时间
TimePoint end_time = start_time + days * 24 * 3600.0;
// 执行轨道预报
result = hpop.propagate(start_time, end_time, position, velocity);
if (result == eNoError) {
std::cout << "\n传播时长: " << days << " 天" << std::endl;
// std::cout << "结束时间: " << end_time.toString() << std::endl;
// 计算轨道参数变化
double initial_radius = initial_position.norm() / 1000.0; // km
double final_radius = position.norm() / 1000.0; // km
double radius_change = final_radius - initial_radius;
double initial_speed = initial_velocity.norm() / 1000.0; // km/s
double final_speed = velocity.norm() / 1000.0; // km/s
double speed_change = final_speed - initial_speed;
std::cout << "轨道半径变化: " << radius_change << " km" << std::endl;
std::cout << "轨道速度变化: " << speed_change << " km/s" << std::endl;
} else {
std::cout << "传播 " << days << " 天失败,错误码: " << result << std::endl;
}
}
return 0;
}系统架构
仿真引擎
HPOP基于一个类似Simulink的仿真引擎实现:
- 时间管理:统一的仿真时间步进控制
- 数据流管理:模块间数据传递和共享机制
- 积分器接口:支持多种数值积分算法
功能模块分类
天文模块 (BlockAstro)
- 二体动力学、引力场计算、相对论效应等
通用模块 (BlockCommon)
- 数学运算、逻辑操作、信号路由等
输入输出模块
- 数据源、数据接收、文件输出等
精度与性能
精度特点
- 最高精度:数值积分方法,可达到较高精度
- 全面摄动:支持所有主要摄动力模型的精确模拟
- 可配置性:可根据任务需求调整精度和计算复杂度
性能考虑
- 计算开销:相比解析方法,计算量较大
- 内存使用:需要存储中间状态和力模型数据
- 实时性:适合离线高精度轨道预报,实时应用需优化
配置指南
力模型选择
根据任务需求选择合适的力模型:
- 近地轨道:重力场(高阶)+大气阻力+月球引力
- 中高轨道:重力场(低阶)+太阳光压+三体引力
- 深空轨道:精密星历+太阳光压+相对论效应
积分器选择
- RKF78等变步长积分器
- RK4、RK8等定步长积分器
注意事项
- 初始化前必须正确配置力模型和积分器
- 长时间预报需要考虑力模型参数的时效性
- 高精度计算需要相应的星历和地球定向参数支持
- 内存和计算资源需求随模型复杂度增加
优势与局限
优势
- 模块化设计便于维护和调试
- 支持复杂摄动力模型的精确模拟
- 可灵活组合满足不同任务需求
- 提供统一的误差控制和精度管理
局限
- 架构复杂,需要考虑模块依赖关系
- 数据流管理需要精心设计
- 计算资源需求较高
- 实时应用需要性能优化
API参考
///
/// @file HPOP.hpp
/// @brief ~
/// @details ~
/// @author axel
/// @date 2026-01-16
/// @copyright 版权所有 (C) 2026-present, ast项目.
///
/// ast项目(https://github.com/space-ast/ast)
/// 本项目基于 Apache 2.0 开源许可证分发。
/// 您可在遵守许可证条款的前提下使用、修改和分发本软件。
/// 许可证全文请见:
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// 重要须知:
/// 软件按"现有状态"提供,无任何明示或暗示的担保条件。
/// 除非法律要求或书面同意,作者与贡献者不承担任何责任。
/// 使用本软件所产生的风险,需由您自行承担。
#pragma once
#include "AstGlobal.h"
#include "AstUtil/Constants.h"
#include "AstCore/CelestialBody.hpp"
#include <string>
#include <vector>
AST_NAMESPACE_BEGIN
/*!
@addtogroup Propagator
@{
*/
class HPOPEquation;
class ODEIntegrator;
class HPOPForceModel;
/// @brief 高精度轨道预报接口类
class AST_CORE_API HPOP
{
public:
HPOP() = default;
~HPOP();
public:
/// @brief 设置力模型
errc_t setForceModel(const HPOPForceModel& forcemodel);
/// @brief 设置预报坐标系
errc_t setPropagationFrame(Frame* frame);
/// @brief 设置积分器
void setIntegrator(ODEIntegrator* integrator);
/// @brief 获取积分器
ODEIntegrator* getIntegrator() const;
/// @brief 轨道预报
/// 考虑到有停止条件,所以预报结束时间同时也是一个输出参数
/// @param[in] startTime 预报起始时间
/// @param[in,out] targetTime 预报结束时间
/// @param[in,out] position 输出位置向量
/// @param[in,out] velocity 输出速度向量
/// @return errc_t 错误码
errc_t propagate(const TimePoint& startTime, TimePoint& targetTime, Vector3d& position, Vector3d& velocity);
/// @brief 初始化
errc_t initialize();
protected:
HPOPEquation* equation_{nullptr}; ///< 高精度轨道预报方程
mutable ODEIntegrator* integrator_{nullptr}; ///< 高精度轨道预报积分器
};
/*! @} */
AST_NAMESPACE_END