Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phase change implementation #16

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading