Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
Feature/maneuvers (#79)
Browse files Browse the repository at this point in the history
* Implement maneuvers

* Implement attitudes

* Upgrade API and Scenario

* Improve test coverage

* Fix Cosmographia export

* Fix orientation computation

* Fix warnings

* Upgrade native astrodynamics framework
  • Loading branch information
sylvain-guillet authored Mar 5, 2024
1 parent e3a1097 commit 2622e1d
Show file tree
Hide file tree
Showing 153 changed files with 2,278 additions and 2,294 deletions.
1 change: 0 additions & 1 deletion IO.Astrodynamics.CLI.Tests/BodyInformationTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Text;
using IO.Astrodynamics.CLI.Commands;
using IO.Astrodynamics.CLI.Commands.Parameters;

namespace IO.Astrodynamics.CLI.Tests;

Expand Down
1 change: 0 additions & 1 deletion IO.Astrodynamics.CLI.Tests/FrameTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Text;
using IO.Astrodynamics.CLI.Commands;
using IO.Astrodynamics.CLI.Commands.Parameters;
using IO.Astrodynamics.Time;

namespace IO.Astrodynamics.CLI.Tests;

Expand Down
1 change: 0 additions & 1 deletion IO.Astrodynamics.CLI.Tests/OrbitalParametersTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Text;
using IO.Astrodynamics.CLI.Commands;
using IO.Astrodynamics.CLI.Commands.Parameters;
using IO.Astrodynamics.Time;

namespace IO.Astrodynamics.CLI.Tests;

Expand Down
1 change: 0 additions & 1 deletion IO.Astrodynamics.CLI.Tests/PropagateTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2024. Sylvain Guillet (sylvain.guillet@tutamail.com)

using System.Globalization;
using System.Text;
using IO.Astrodynamics.CLI.Commands;
using IO.Astrodynamics.CLI.Commands.Parameters;
Expand Down
6 changes: 0 additions & 6 deletions IO.Astrodynamics.CLI/Commands/BodyInformationCommand.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
using System;
using System.Globalization;
using System.IO;
using System.Threading.Tasks;
using Cocona;
using IO.Astrodynamics.Body;
using IO.Astrodynamics.Body.Spacecraft;
using IO.Astrodynamics.CLI.Commands.Parameters;
using IO.Astrodynamics.Frames;
using IO.Astrodynamics.OrbitalParameters;
using IO.Astrodynamics.Time;

namespace IO.Astrodynamics.CLI.Commands;

Expand Down
3 changes: 0 additions & 3 deletions IO.Astrodynamics.CLI/Commands/EphemerisCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
using System.Threading.Tasks;
using Cocona;
using IO.Astrodynamics.Body;
using IO.Astrodynamics.Body.Spacecraft;
using IO.Astrodynamics.CLI.Commands.Parameters;
using IO.Astrodynamics.Frames;
using IO.Astrodynamics.Surface;
using IO.Astrodynamics.Time;

namespace IO.Astrodynamics.CLI.Commands;

Expand Down
5 changes: 0 additions & 5 deletions IO.Astrodynamics.CLI/Commands/FrameConverterCommand.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using System;
using System.Globalization;
using System.IO;
using System.Threading.Tasks;
using Cocona;
using IO.Astrodynamics.Body;
using IO.Astrodynamics.Body.Spacecraft;
using IO.Astrodynamics.CLI.Commands.Parameters;
using IO.Astrodynamics.Frames;
using IO.Astrodynamics.OrbitalParameters;
using IO.Astrodynamics.Time;

namespace IO.Astrodynamics.CLI.Commands;

Expand Down
3 changes: 0 additions & 3 deletions IO.Astrodynamics.CLI/Commands/GeometryFinderCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
using System.IO;
using System.Threading.Tasks;
using Cocona;
using IO.Astrodynamics.Body;
using IO.Astrodynamics.Body.Spacecraft;
using IO.Astrodynamics.CLI.Commands.Parameters;
using IO.Astrodynamics.Frames;
using IO.Astrodynamics.OrbitalParameters;
using IO.Astrodynamics.Time;

namespace IO.Astrodynamics.CLI.Commands;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
using System;
using System.Globalization;
using System.IO;
using System.Threading.Tasks;
using Cocona;
using IO.Astrodynamics.Body;
using IO.Astrodynamics.Body.Spacecraft;
using IO.Astrodynamics.CLI.Commands.Parameters;
using IO.Astrodynamics.Frames;
using IO.Astrodynamics.Math;
using IO.Astrodynamics.OrbitalParameters;
using IO.Astrodynamics.Time;

namespace IO.Astrodynamics.CLI.Commands;

Expand Down
2 changes: 0 additions & 2 deletions IO.Astrodynamics.CLI/Commands/OrientationCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using System.IO;
using System.Threading.Tasks;
using Cocona;
using IO.Astrodynamics.Body;
using IO.Astrodynamics.Body.Spacecraft;
using IO.Astrodynamics.CLI.Commands.Parameters;
using IO.Astrodynamics.Frames;
using IO.Astrodynamics.OrbitalParameters;
Expand Down
2 changes: 0 additions & 2 deletions IO.Astrodynamics.CLI/Commands/Parameters/WindowParameters.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Copyright 2024. Sylvain Guillet (sylvain.guillet@tutamail.com)

using System;
using System.Text;
using Cocona;

namespace IO.Astrodynamics.CLI.Commands.Parameters;
Expand Down
7 changes: 1 addition & 6 deletions IO.Astrodynamics.CLI/Commands/PropagateCommand.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Cocona;
using IO.Astrodynamics.Body;
using IO.Astrodynamics.Body.Spacecraft;
using IO.Astrodynamics.CLI.Commands.Parameters;
using IO.Astrodynamics.Cosmographia;
using IO.Astrodynamics.Frames;
using IO.Astrodynamics.Mission;
using IO.Astrodynamics.OrbitalParameters;
using IO.Astrodynamics.Time;

namespace IO.Astrodynamics.CLI.Commands;

Expand Down Expand Up @@ -64,7 +59,7 @@ public async Task Propagate(
//Simulate
var qualifiedOutputDirectory = new DirectoryInfo(outputDirectory);
Console.WriteLine("Orbit propagation in progress. This operation could take a long time. Duration expected for one orbit 7000km x 7000km on mid range computer with geopotential N=30 = 600ms");
await scenario.SimulateWithoutManeuverAsync(qualifiedOutputDirectory, useAtmosphericDrag, useSolarRadiationPressure);
await scenario.SimulateAsync(qualifiedOutputDirectory, useAtmosphericDrag, useSolarRadiationPressure,TimeSpan.FromSeconds(1.0));

//Export to cosmographia
CosmographiaExporter cosmographiaExporter = new CosmographiaExporter();
Expand Down
4 changes: 0 additions & 4 deletions IO.Astrodynamics.CLI/Commands/TimeConverterCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
using System.Globalization;
using System.Threading.Tasks;
using Cocona;
using IO.Astrodynamics.Body;
using IO.Astrodynamics.Body.Spacecraft;
using IO.Astrodynamics.CLI.Commands.Parameters;
using IO.Astrodynamics.Frames;
using IO.Astrodynamics.OrbitalParameters;
using IO.Astrodynamics.Time;

namespace IO.Astrodynamics.CLI.Commands;
Expand Down
9 changes: 5 additions & 4 deletions IO.Astrodynamics.CLI/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal static CelestialItem CreateCelestialItem(int objectId)
}
else
{
localizableObject = new Spacecraft(objectId, $"spc{objectId}", 1.0, 1.0, new Clock($"clk{objectId}", 1 / 65536.0), null);
localizableObject = new Spacecraft(objectId, $"spc{objectId}", 1.0, 1.0, new Clock($"clk{objectId}", 65536), null);
}

return localizableObject;
Expand All @@ -60,7 +60,7 @@ internal static IOrientable CreateOrientable(int objectId)
}
else
{
celestialItem = new Spacecraft(objectId, "spc", 1.0, 1.0, new Clock("clk", 1 / 65536.0), null);
celestialItem = new Spacecraft(objectId, "spc", 1.0, 1.0, new Clock("clk", 65536), null);
}

return celestialItem;
Expand Down Expand Up @@ -113,6 +113,7 @@ internal static OrbitalParameters.OrbitalParameters ConvertToOrbitalParameters(s
{
originalFrame = "j2000";
}

var inputFrame = new Frame(originalFrame);
var inputEpoch = Helpers.ConvertDateTimeInput(epoch);

Expand Down Expand Up @@ -173,11 +174,11 @@ internal static Window ConvertWindowInput(string begin, string end)
return new Window(ConvertDateTimeInput(begin), ConvertDateTimeInput(end));
}

internal static Window ConvertWindowInput(EpochParameters begin,EpochParameters end)
internal static Window ConvertWindowInput(EpochParameters begin, EpochParameters end)
{
return ConvertWindowInput(begin.Epoch, end.Epoch);
}

internal static Window ConvertWindowInput(WindowParameters windowParameters)
{
return ConvertWindowInput(windowParameters.Begin, windowParameters.End);
Expand Down
2 changes: 1 addition & 1 deletion IO.Astrodynamics.CLI/IO.Astrodynamics.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<FileVersion>0.0.1</FileVersion>
<PackAsTool>true</PackAsTool>
<ToolCommandName>astro</ToolCommandName>
<Version>0.0.1</Version>
<Version>0.1.0</Version>
<Title>Astrodynamics command line interface</Title>
<Authors>Sylvain Guillet</Authors>
<Description>This CLI allows end user to exploit IO.Astrodynamics framework </Description>
Expand Down
18 changes: 9 additions & 9 deletions IO.Astrodynamics.Performance/Scenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace IO.Astrodynamics.Performance;
[SkewnessColumn]
[KurtosisColumn]
[StatisticalTestColumn]
[ShortRunJob]
// [ShortRunJob]
public class Scenario
{
private readonly GeopotentialGravitationalField _geopotential;
Expand All @@ -29,7 +29,7 @@ public class Scenario
private readonly CelestialBody _sun;
private readonly CelestialBody _moon;
private readonly VVIntegrator _integrator;
private readonly Propagator.Propagator _propagator;
private readonly Propagator.SpacecraftPropagator _spacecraftPropagator;
// IO.Astrodynamics.Tests.Mission.ScenarioTests _scenario = new IO.Astrodynamics.Tests.Mission.ScenarioTests();

public Scenario()
Expand All @@ -39,7 +39,7 @@ public Scenario()
_moon = new CelestialBody(301);
_sun = new CelestialBody(10);
_geopotential = new GeopotentialGravitationalField(new StreamReader("Data/SolarSystem/EGM2008_to70_TideFree"));
Clock clk = new Clock("My clock", 1.0 / 256.0);
Clock clk = new Clock("My clock", 256);
Spacecraft spc = new Spacecraft(-1001, "MySpacecraft", 100.0, 10000.0, clk,
new StateVector(new Vector3(6800000.0, 0.0, 0.0), new Vector3(0.0, 7656.2204182967143, 0.0), _earth, DateTimeExtension.J2000, Frames.Frame.ICRF));
_srp = new SolarRadiationPressure(spc);
Expand All @@ -53,11 +53,11 @@ public Scenario()
_integrator = new VVIntegrator(forces, TimeSpan.FromSeconds(1.0), new StateVector(new Vector3(6800000.0 - Random.Shared.NextDouble(), 0.0, 0.0),
new Vector3(0.0, 8000.0 - Random.Shared.NextDouble(), 0.0), _earth,
DateTimeExtension.J2000, Frame.ICRF));
_propagator = new Propagator.Propagator(new Window(DateTimeExtension.J2000, DateTimeExtension.J2000 + spc.InitialOrbitalParameters.Period()), spc,
_spacecraftPropagator = new Propagator.SpacecraftPropagator(new Window(DateTimeExtension.J2000, DateTimeExtension.J2000 + spc.InitialOrbitalParameters.Period()), spc,
new[] { _moon, _earth, _sun }, true, true, TimeSpan.FromSeconds(1.0));
}

// [Benchmark(Description = "Spacecraft propagator C++")]
// [Benchmark(Description = "Spacecraft spacecraftPropagator C++")]
public void Propagate()
{
// _scenario.PropagateWithoutManeuver();
Expand Down Expand Up @@ -96,13 +96,13 @@ public void VVIntegration()
// var res = _integrator.Integrate(sv);
}

// [Benchmark(Description = "Propagator per orbit (GeoPotentials // Moon and sun perturbation // Atmospheric drag // Solar radiation) ")]
[Benchmark(Description = "SpacecraftPropagator per orbit (GeoPotentials // Moon and sun perturbation // Atmospheric drag // Solar radiation) ")]
public void Propagator()
{
var res = _propagator.Propagate();
var res = _spacecraftPropagator.Propagate();
}

[Benchmark(Description = "IO Vector", Baseline = true)]
// [Benchmark(Description = "IO Vector", Baseline = true)]
public void Vector()
{
Vector3 vectorA = new Vector3(1.0, 2.0, 3.0);
Expand Down Expand Up @@ -169,7 +169,7 @@ public void Vector()
mag = tot.Magnitude();
}

[Benchmark(Description = "Numerics Vector")]
// [Benchmark(Description = "Numerics Vector")]
public void VectorNumerics()
{
var vectorA = new Vector<double>([0.0, 1.0, 2.0, 3.0]);
Expand Down
Loading

0 comments on commit 2622e1d

Please sign in to comment.