File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/OpenSpaceToolkit/Astrodynamics/Trajectory Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -788,8 +788,24 @@ Segment::Solution Segment::solve(
788788 // function will append them a second time.
789789 segmentStates.add (Array<State>(coastSolution.states .begin () + 1 , coastSolution.states .end ()));
790790
791+ Instant maximumManeuverSolutionInstant = maximumInstant;
792+
793+ if (maneuverConstraints_.maximumDuration .isDefined () &&
794+ maneuverConstraints_.maximumDurationStrategy == MaximumManeuverDurationViolationStrategy::Chunk)
795+ {
796+ // Performance when considering a maximum maneuver duration constraint for the "Chunk" strategy
797+ // can be optimized by eliminating redundant solver iterations and unnecessary trimming.
798+ //
799+ // Since the "Chunk" strategy does not need to know when the burn is going to end, we can safely
800+ // assume that the burn (or chunk for that matter) should not take longer than said maximum duration.
801+ maximumManeuverSolutionInstant = std::min (
802+ segmentStates.accessLast ().accessInstant () + maneuverConstraints_.maximumDuration ,
803+ maximumManeuverSolutionInstant
804+ );
805+ }
806+
791807 const Segment::Solution maneuverSolution =
792- solveUntilThrusterOff_ (segmentStates.accessLast (), maximumInstant , thrusterDynamics);
808+ solveUntilThrusterOff_ (segmentStates.accessLast (), maximumManeuverSolutionInstant , thrusterDynamics);
793809
794810 if (maneuverSolution.states .getSize () <= 2 )
795811 {
You can’t perform that action at this time.
0 commit comments