Skip to content

Commit

Permalink
phase change implementation (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
ATTron authored Jul 10, 2024
1 parent 6257da5 commit 33cb6a3
Show file tree
Hide file tree
Showing 6 changed files with 777,856 additions and 432,059 deletions.
59 changes: 56 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
- [x] TLE Support
- [x] Orbital Propagation
- [x] RK4
- [ ] Orbital Maneuvers
- [x] Orbital Maneuvers
- [x] Impulse Maneuvers
- [x] Phase Maneuvers
- [ ] Plane Change Maneuvers
- [x] Plane Change Maneuvers

### Astronomical

Expand Down Expand Up @@ -208,6 +208,60 @@ const constants = astroz.constants;
const spacecraft = astroz.spacecraft;
const Spacecraft = spacecraft.Spacecraft;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
const test_tle =
\\1 55909U 23035B 24187.51050877 .00023579 00000+0 16099-2 0 9998
\\2 55909 43.9978 311.8012 0011446 278.6226 81.3336 15.05761711 71371
;
var tle = try TLE.parse(test_tle, allocator);
defer tle.deinit();
var test_sc = Spacecraft.create("dummy_sc", tle, 300.000, spacecraft.Satellite_Size.Cube, constants.earth, allocator);
defer test_sc.deinit();
const plane_change_maneuver = Impulse{
.time = 2500000.0,
.delta_v = .{ 0.0, 0.0, 0.0 }, // Not used for plane changes
.mode = .Plane_Change,
.plane_change = .{
.delta_inclination = math.pi / 18.0, // 10-degree inclination change
.delta_raan = math.pi / 36.0, // 5-degree RAAN change
},
};
const impulses = [_]Impulse{plane_change_maneuver};
try test_sc.propagate(
test_sc.tle.first_line.epoch,
3, // 3 days worth of orbit predictions
1, // steps, i.e. repredict every simulated second
&impulses,
);
for (test_sc.orbit_predictions.items) |iter| {
const r = math.sqrt(iter.state[0] * iter.state[0] + iter.state[1] * iter.state[1] + iter.state[2] * iter.state[2]);
std.debug.print("Next Prediction is: {any}\n", .{r});
}
}
```

#### Orbit Phase Change

```zig
const std = @import("std");
const math = std.math;
const astroz = @import("astroz");
const TLE = astroz.tle.TLE;
const constants = astroz.constants;
const spacecraft = astroz.spacecraft;
const Spacecraft = spacecraft.Spacecraft;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
Expand Down Expand Up @@ -246,7 +300,6 @@ pub fn main() !void {
std.debug.print("Next Prediction is: {any}\n", .{r});
}
}
```
#### Setup Vita49 Parser
Expand Down
Binary file modified docs/sources.tar
Binary file not shown.
Loading

0 comments on commit 33cb6a3

Please sign in to comment.