Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a96c08b5ff7d
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cb74501a322d
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Dec 3, 2020

  1. Extended mission

    eggrobin committed Dec 3, 2020
    Copy the full SHA
    2aaea81 View commit details

Commits on Dec 5, 2020

  1. Merge pull request #2807 from eggrobin/extended-mission

    Extended mission in the analyser
    eggrobin authored Dec 5, 2020
    Copy the full SHA
    cb74501 View commit details
Showing with 34 additions and 27 deletions.
  1. +31 −27 ksp_plugin/orbit_analyser.cpp
  2. +3 −0 ksp_plugin/orbit_analyser.hpp
58 changes: 31 additions & 27 deletions ksp_plugin/orbit_analyser.cpp
Original file line number Diff line number Diff line change
@@ -94,33 +94,6 @@ Status OrbitAnalyser::RepeatedlyAnalyseOrbit() {
DiscreteTrajectory<Barycentric> trajectory;
trajectory.Append(parameters.first_time,
parameters.first_degrees_of_freedom);
std::vector<not_null<DiscreteTrajectory<Barycentric>*>> trajectories = {
&trajectory};
auto instance = ephemeris_->NewInstance(
trajectories,
Ephemeris<Barycentric>::NoIntrinsicAccelerations,
analysed_trajectory_parameters_);
for (Instant t =
parameters.first_time + parameters.mission_duration / 0x1p10;
trajectory.back().time <
parameters.first_time + parameters.mission_duration;
t += parameters.mission_duration / 0x1p10) {
if (!ephemeris_->FlowWithFixedStep(t, *instance).ok()) {
// TODO(egg): Report that the integration failed.
break;
}
progress_of_next_analysis_ =
(trajectory.back().time - parameters.first_time) /
parameters.mission_duration;
RETURN_IF_STOPPED;
}
analysis.mission_duration_ =
trajectory.back().time - parameters.first_time;

// TODO(egg): |next_analysis_percentage_| only reflects the progress of the
// integration, but the analysis itself can take a while; this results in
// the progress bar being stuck at 100% while the elements and nodes are
// being computed.

RotatingBody<Barycentric> const* primary = nullptr;
auto smallest_osculating_period = Infinity<Time>;
@@ -141,6 +114,37 @@ Status OrbitAnalyser::RepeatedlyAnalyseOrbit() {
}
}
if (primary != nullptr) {
std::vector<not_null<DiscreteTrajectory<Barycentric>*>> trajectories = {
&trajectory};
auto instance = ephemeris_->NewInstance(
trajectories,
Ephemeris<Barycentric>::NoIntrinsicAccelerations,
analysed_trajectory_parameters_);
Time const analysis_duration =
std::min(parameters.extended_mission_duration.value_or(
parameters.mission_duration),
std::max(2 * smallest_osculating_period,
parameters.mission_duration));
for (Instant t = parameters.first_time + analysis_duration / 0x1p10;
trajectory.back().time < parameters.first_time + analysis_duration;
t += analysis_duration / 0x1p10) {
if (!ephemeris_->FlowWithFixedStep(t, *instance).ok()) {
// TODO(egg): Report that the integration failed.
break;
}
progress_of_next_analysis_ =
(trajectory.back().time - parameters.first_time) /
analysis_duration;
RETURN_IF_STOPPED;
}
analysis.mission_duration_ =
trajectory.back().time - parameters.first_time;

// TODO(egg): |next_analysis_percentage_| only reflects the progress of
// the integration, but the analysis itself can take a while; this results
// in the progress bar being stuck at 100% while the elements and nodes
// are being computed.

using PrimaryCentred = Frame<enum class PrimaryCentredTag, NonRotating>;
DiscreteTrajectory<PrimaryCentred> primary_centred_trajectory;
BodyCentredNonRotatingDynamicFrame<Barycentric, PrimaryCentred>
3 changes: 3 additions & 0 deletions ksp_plugin/orbit_analyser.hpp
Original file line number Diff line number Diff line change
@@ -89,6 +89,9 @@ class OrbitAnalyser {
Instant first_time;
DegreesOfFreedom<Barycentric> first_degrees_of_freedom;
Time mission_duration;
// The analyser may compute the trajectory up to |extended_mission_duration|
// to ensure that at least one revolution is analysed.
std::optional<Time> extended_mission_duration;
};

OrbitAnalyser(not_null<Ephemeris<Barycentric>*> ephemeris,