Browse Source

Update technical_reference: add rendezvous module, HohmannTransfer struct, and reset_spacecraft_tracking step

main
cinnaboot 3 months ago
parent
commit
7c7a8430a9
  1. 39
      docs/technical_reference.md

39
docs/technical_reference.md

@ -11,6 +11,7 @@ Modular C-style C++ (structs/functions, no classes). Module dependencies:
```
Main → Simulation → Orbital Mechanics → Physics
→ Maneuver
→ Rendezvous
→ Config Loader
```
@ -57,6 +58,9 @@ Similar to CelestialBody but without radius or SOI. Supports standalone (parent_
### Maneuver
Impulsive burn: name, craft_index, direction, delta_v, trigger_type, trigger_value, scheduled_dt, executed flag, executed_time.
### HohmannTransfer
Hohmann transfer calculation result: dv1 (first burn delta-v), dv2 (second burn delta-v), transfer_time (half-period of transfer ellipse), true_anomaly_2 (true anomaly at second burn, typically π).
### SimulationState
Top-level container: arrays of bodies/spacecraft/maneuvers (with counts and capacities), time, dt, config_name.
@ -137,6 +141,28 @@ True anomaly triggers must execute at precise orbital position:
**Wraparound handling**: When current_nu > 5.0 and future_nu < 1.0, detect 0 crossing at periapsis.
### Hohmann Transfer
`calculate_hohmann_transfer()` computes optimal two-burn transfer between two circular orbits using the vis-viva equation. Transfer time equals half the period of the transfer ellipse.
## Rendezvous Module
Handles orbital rendezvous planning and execution via Hohmann transfers and phasing maneuvers.
**Hohmann Transfer Planning**:
- `calculate_required_separation_for_hohmann()` - computes ideal angular separation between chaser and target at first burn
- `calculate_wait_time_for_hohmann()` - determines wait time before starting transfer (positive = wait, negative = late)
- `calculate_next_hohmann_wait_time()` - like above but always returns non-negative by advancing to next phasing opportunity
- `calculate_relative_orbit_period()` - time between consecutive phasing opportunities
**Maneuver Creation**:
- `create_hohmann_departure_maneuver()` - adds prograde burn to enter transfer orbit (supports true anomaly or immediate trigger)
- `create_hohmann_arrival_maneuver()` - adds circularization burn to match target orbit (triggered at target radius)
**Verification**:
- `verify_hohmann_transfer_orbit()` - checks if current orbit matches expected Hohmann transfer parameters
- `validate_hohmann_transfer_parameters()` - validates transfer parameters before calculation
- `hohmann_transfer_complete()` - checks if transfer time has elapsed and spacecraft is at target radius
## Simulation Loop
**Initialization**:
@ -147,12 +173,13 @@ True anomaly triggers must execute at precise orbital position:
5. Main loop begins
**Main Loop Order**:
1. update_bodies_physics() - SOI checks, drift detection, propagation
2. compute_global_coordinates()
3. execute_pending_maneuvers()
4. update_spacecraft_physics()
5. compute_spacecraft_globals()
6. time += dt
1. reset_spacecraft_tracking() - reset spacecraft handled flags
2. update_bodies_physics() - SOI checks, drift detection, propagation
3. compute_global_coordinates()
4. execute_pending_maneuvers()
5. update_spacecraft_physics()
6. compute_spacecraft_globals()
7. time += dt
**Body Physics Per-Frame**:
- Check SOI via find_dominant_body()

Loading…
Cancel
Save