nyx-space / nyx

Nyx is a high fidelity, fast, reliable and validated astrodynamics toolkit library written in Rust and available in Python
https://nyxspace.com
GNU Affero General Public License v3.0
198 stars 20 forks source link

Spacecraft Dynamics to support serialization and pickle #214

Open ChristopherRabotin opened 1 year ago

ChristopherRabotin commented 1 year ago

High level description

Spacecraft dynamics needs to be serializable. This is needed for Insight to reload a specific scenario and serialize it. This should also allow for the definition of spacecraft dynamics using the TypeBuilder trait approach.

Requirements

Test plans

Design

The advantage of Dhall here is that it supports imports and is strict. The disadvantage is that it isn't necessarily very legible. This serialization should also support other less-strict approaches like TOML.

To ensure that the order is preserved, consider storing the models in a BTreeMap. It may also be useful for future reference to specify whether each model is enabled or not: this would allow for quickly turning on and off models for comparisons instead of rebuilding the spacecraft dynamics.

This is a spin off from #212.

ChristopherRabotin commented 3 days ago

This might be simpler than expected for all but the harmonics. The harmonics currently do not store the path to the file and instead store the actual data. Other types can be serialized either as yaml or Dhall, but not toml because Frame can have Nones. Frame already is serializable in Dhall, so it may be worth keeping that and using Dhall for things that aren't generally manually edited (like ground stations in OD).