Program Listing for File ephemeris_simulation.h¶
↰ Return to documentation for file (simulations/ephemeris/ephemeris_simulation.h)
#pragma once
#include <string>
#include <vector>
#include "lupnt/conversions/frame_converter.h"
#include "lupnt/core/constants.h"
#include "lupnt/simulations/simulation.h"
namespace lupnt {
struct EphemerisOrbitConfig {
double a_m = 6541.4e3;
double ecc = 0.6;
double inc_rad = 56.2 * RAD;
double raan_rad = 0.0;
double argp_rad = 90.0 * RAD;
double m0_rad = 0.0;
Frame coe_frame = Frame::MOON_OP;
};
struct EphemerisSimulationConfig {
std::string start_epoch_utc = "2027-01-01T00:00:00";
EphemerisOrbitConfig orbit;
Frame propagate_frame = Frame::MOON_CI;
double duration_days = 3.0;
double sample_dt_s = 60.0;
// Force model for the numerically propagated truth trajectory.
int moon_gravity_degree = 20;
int moon_gravity_order = 20;
bool include_earth = true;
bool include_sun = true;
bool use_relativity = false;
double integration_step_s = 30.0;
std::vector<double> fit_window_minutes = {60.0, 120.0, 240.0, 480.0};
int num_windows = 6;
int cartesian_poly_order = 8;
bool cartesian_use_keplerian_baseline = true;
int cartesian_num_fourier_terms = 0;
int almanac_poly_order = 1;
int almanac_num_fourier_terms = 1;
Frame output_frame = Frame::MOON_CI;
double datasize_precision_m = 0.01;
};
struct EphemerisWindowResult {
double fit_window_min = 0.0;
int num_params = 0;
int total_bits = 0;
double pos_rms_m = 0.0;
double vel_rms_mps = 0.0;
double pos_p95_m = 0.0;
double vel_p95_mps = 0.0;
};
struct EphemerisResults {
VecXd t_truth_s; // Elapsed time since start_epoch_utc [s], size [N]
MatXd rv_truth; // Truth Cartesian states [N x 6] in output_frame
std::vector<EphemerisWindowResult> cartesian_results;
std::vector<EphemerisWindowResult> almanac_results;
};
// The ephemeris/almanac datasize-accuracy study is driven by `EphemerisApp`
// (applications/ephemeris/ephemeris_app.h) on a thin `EphemerisManager` agent, via
// `pnt.Simulation(...)`. The `EphemerisSimulationConfig`/`EphemerisResults` structs above
// are the shared config/result payloads consumed by that app: for each
// `fit_window_minutes` entry, `num_windows` windows are sampled across a numerically
// propagated lunar-orbit truth trajectory; each ephemeris/almanac model is fit and
// evaluated (RMS/95th-percentile RTN position and velocity error) on every window, and the
// minimum per-parameter broadcast resolution (bit count) needed to keep the position
// accuracy within `datasize_precision_m` is found by bisection -- mirroring the
// accuracy/datasize trade-off studies used to size GNSS broadcast ephemeris/almanac
// message formats.
} // namespace lupnt