ostk.astrodynamics.trajectory.Segment

class Segment

Bases: pybind11_object

A Segment that can be solved provided an initial State and termination Event Condition.

Methods

coast

Create a coast segment.

constant_local_orbital_frame_direction_maneuver

Create a maneuvering segment that produces maneuvers with a constant direction in the local orbital frame.

get_dynamics

Get the dynamics.

get_event_condition

Get the event condition.

get_free_dynamics

Get the free dynamics array, devoid of any thruster dynamics.

get_maneuver_constraints

Get the maneuver constraints.

get_name

Get the name of the segment.

get_numerical_solver

Get the numerical solver.

get_thruster_dynamics

Get the thruster dynamics.

get_type

Get the type of the segment.

maneuver

Create a maneuver segment.

solve

Solve the segment until its event condition is satisfied or the maximum propagation duration is reached.

string_from_maximum_maneuver_duration_violation_strategy

Get the string representation of a MaximumManeuverDurationViolationStrategy.

class ManeuverConstraints(*args, **kwargs)

Bases: pybind11_object

Constraints for maneuver segments.

Overloaded function.

  1. __init__(self: ostk.astrodynamics.trajectory.Segment.ManeuverConstraints) -> None

    Default constructor. All durations are undefined and strategy is Fail.

  2. __init__(self: ostk.astrodynamics.trajectory.Segment.ManeuverConstraints, minimum_duration: ostk.physics.time.Duration = Duration.undefined(), maximum_duration: ostk.physics.time.Duration = Duration.undefined(), minimum_separation: ostk.physics.time.Duration = Duration.undefined(), maximum_duration_strategy: ostk.astrodynamics.trajectory.Segment.MaximumManeuverDurationViolationStrategy = Segment.MaximumManeuverDurationViolationStrategy.Fail) -> None

    Construct ManeuverConstraints with specific parameters.

    Args:

    minimum_duration (Duration, optional): The minimum duration for a maneuver. Defaults to Duration.undefined(). maximum_duration (Duration, optional): The maximum duration for a maneuver. Defaults to Duration.undefined(). minimum_separation (Duration, optional): The minimum separation between maneuvers. Defaults to Duration.undefined(). maximum_duration_strategy (MaximumManeuverDurationViolationStrategy, optional): The strategy when maximum duration is violated. Defaults to Segment.MaximumManeuverDurationViolationStrategy.Fail.

interval_has_valid_maximum_duration(
self: ostk.astrodynamics.trajectory.Segment.ManeuverConstraints,
interval: ostk.physics.time.Interval,
) bool

Check if the interval has a valid maximum duration.

interval_has_valid_minimum_duration(
self: ostk.astrodynamics.trajectory.Segment.ManeuverConstraints,
interval: ostk.physics.time.Interval,
) bool

Check if the interval has a valid minimum duration.

is_defined(
self: ostk.astrodynamics.trajectory.Segment.ManeuverConstraints,
) bool

Check if any of the constraints are defined.

Returns:

True if at least one constraint is defined, False otherwise.

Return type:

bool

property maximum_duration

The maximum duration for a maneuver.

Type:

Duration

property maximum_duration_strategy

The strategy to use when a maneuver exceeds the maximum duration.

Type:

MaximumManeuverDurationViolationStrategy

property minimum_duration

The minimum duration for a maneuver.

Type:

Duration

property minimum_separation

The minimum separation between maneuvers.

Type:

Duration

class MaximumManeuverDurationViolationStrategy(
self: ostk.astrodynamics.trajectory.Segment.MaximumManeuverDurationViolationStrategy,
value: int,
)

Bases: pybind11_object

Strategy to use when a maneuver exceeds the maximum duration constraint.

Fail: Will throw a RuntimeError if a maneuver exceeds the maximum duration. Skip: The maneuver will be skipped entirely. TruncateEnd: The maneuver will be shortened to the maximum duration, truncating the trailing edge. TruncateStart: The maneuver will be shortened to the maximum duration, truncating the leading edge. Center: The maneuver will be shortened to the maximum duration, truncating the edges, keeping the centered part of the maneuver. Chunk: The maneuver will be split into chunks from the leading edge.

Example: Maximum duration: [------] Proposed maneuver: [---------------------------------] TruncateEnd: [------] Center: [------] TruncateStart: [------] Chunk: [------] [------] [------] [---]

Members:

Fail : Will throw an exception if a maneuver exceeds the maximum duration.

Skip : The maneuver will be skipped entirely.

TruncateEnd : The maneuver will be shortened to the maximum duration, truncating the trailing edge.

TruncateStart : The maneuver will be shortened to the maximum duration, truncating the leading edge.

Center : The maneuver will be shortened to the maximum duration, truncating the edges, keeping the centered part of the maneuver.

Chunk : The maneuver will be split into chunks from the leading edge.

property name
class Solution(*args, **kwargs)

Bases: pybind11_object

The Solution object returned when a Segment is solved.

Overloaded function.

  1. __init__(self: ostk.astrodynamics.trajectory.Segment.Solution, name: ostk.core.type.String, dynamics: list[ostk::astrodynamics::Dynamics], states: list[ostk.astrodynamics.trajectory.State], condition_is_satisfied: bool, segment_type: ostk.astrodynamics.trajectory.Segment.Type) -> None

    Construct a Segment Solution.

    Args:

    name (str): The name of the segment. dynamics (list[Dynamics]): The dynamics. states (list[State]): The states. condition_is_satisfied (bool): Whether the event condition is satisfied. segment_type (Type): The type of the segment.

  2. __init__(self: ostk.astrodynamics.trajectory.Segment.Solution, name: ostk.core.type.String, dynamics: list[ostk::astrodynamics::Dynamics], states: list[ostk.astrodynamics.trajectory.State], condition_is_satisfied: bool, segment_type: ostk.astrodynamics.trajectory.Segment.Type, maneuver_intervals: list[ostk.physics.time.Interval]) -> None

    Construct a Segment Solution with maneuver intervals.

    Args:

    name (str): The name of the segment. dynamics (list[Dynamics]): The dynamics. states (list[State]): The states. condition_is_satisfied (bool): Whether the event condition is satisfied. segment_type (Type): The type of the segment. maneuver_intervals (list[Interval]): The maneuver intervals (for maneuver segments).

access_end_instant(
self: ostk.astrodynamics.trajectory.Segment.Solution,
) ostk.physics.time.Instant

Get the instant at which the segment ends.

Returns:

The instant at which the segment ends.

Return type:

Instant

access_start_instant(
self: ostk.astrodynamics.trajectory.Segment.Solution,
) ostk.physics.time.Instant

Get the instant at which the segment starts.

Returns:

The instant at which the segment starts.

Return type:

Instant

calculate_states_at(
self: ostk.astrodynamics.trajectory.Segment.Solution,
instants: list[ostk.physics.time.Instant],
numerical_solver: ostk.astrodynamics.trajectory.state.NumericalSolver,
) list[ostk.astrodynamics.trajectory.State]

Calculate the states in this segment's solution at the given instants.

Parameters:
  • instants (list[Instant]) -- The instants at which the states will be calculated.

  • numerical_solver (NumericalSolver) -- The numerical solver used to calculate the states.

Returns:

The states at the provided instants.

Return type:

list[State]

compute_delta_mass(
self: ostk.astrodynamics.trajectory.Segment.Solution,
) ostk.physics.unit.Mass

Compute the delta mass.

Returns:

The delta mass.

Return type:

Mass

compute_delta_v(
self: ostk.astrodynamics.trajectory.Segment.Solution,
specific_impulse: ostk.core.type.Real,
) ostk.core.type.Real

Compute the delta V.

Parameters:

specific_impulse (float) -- The specific impulse.

Returns:

The delta V (m/s).

Return type:

float

property condition_is_satisfied

Whether the event condition is satisfied.

Type:

bool

property dynamics

The dynamics.

Type:

Dynamics

extract_maneuvers(
self: ostk.astrodynamics.trajectory.Segment.Solution,
frame: ostk.physics.coordinate.Frame,
) list[ostk::astrodynamics::flight::Maneuver]

Extract maneuvers from the (maneuvering) segment.

Returns:

The list of maneuvers.

Return type:

list[Maneuver]

get_all_dynamics_contributions(
self: ostk.astrodynamics.trajectory.Segment.Solution,
frame: ostk.physics.coordinate.Frame,
) dict[ostk::astrodynamics::Dynamics, numpy.ndarray[numpy.float64[m, n]]]

Compute the contributions of all segment's dynamics in the provided frame for all states assocated with the segment.

Parameters:

frame (Frame) -- The frame.

Returns:

The list of matrices with individual dynamics contributions.

Return type:

dict[Dynamics, np.ndarray]

get_dynamics_acceleration_contribution(
self: ostk.astrodynamics.trajectory.Segment.Solution,
dynamics: ostk::astrodynamics::Dynamics,
frame: ostk.physics.coordinate.Frame,
) numpy.ndarray[numpy.float64[m, n]]

Compute the contribution of the provided dynamics to the acceleration in the provided frame for all states associated with the segment.

Parameters:
  • dynamics (Dynamics) -- The dynamics.

  • frame (Frame) -- The frame.

Returns:

The matrix of dynamics contributions to acceleration.

Return type:

np.ndarray

get_dynamics_contribution(
self: ostk.astrodynamics.trajectory.Segment.Solution,
dynamics: ostk::astrodynamics::Dynamics,
frame: ostk.physics.coordinate.Frame,
coordinate_subsets: list[ostk.astrodynamics.trajectory.state.CoordinateSubset] = [],
) numpy.ndarray[numpy.float64[m, n]]

Compute the contribution of the provided dynamics in the provided frame for all states associated with the segment.

Parameters:
  • dynamics (Dynamics) -- The dynamics.

  • frame (Frame) -- The frame.

  • coordinate_subsets (list[CoordinateSubset], optional) -- A subset of the dynamics writing coordinate subsets to consider.

Returns:

The matrix of dynamics contributions for the selected coordinate subsets of the dynamics.

Return type:

MatrixXd

get_final_mass(
self: ostk.astrodynamics.trajectory.Segment.Solution,
) ostk.physics.unit.Mass

Get the final mass.

Returns:

The final mass.

Return type:

Mass

get_initial_mass(
self: ostk.astrodynamics.trajectory.Segment.Solution,
) ostk.physics.unit.Mass

Get the initial mass.

Returns:

The initial mass.

Return type:

Mass

get_interval(
self: ostk.astrodynamics.trajectory.Segment.Solution,
) ostk.physics.time.Interval

Get the time interval of the solution.

Returns:

The interval.

Return type:

Interval

get_propagation_duration(
self: ostk.astrodynamics.trajectory.Segment.Solution,
) ostk.physics.time.Duration

Get the propagation duration.

Returns:

The propagation duration.

Return type:

Duration

get_thruster_dynamics(
self: ostk.astrodynamics.trajectory.Segment.Solution,
) ostk::astrodynamics::dynamics::Thruster

Get the thruster dynamics from the solution.

Returns:

The thruster dynamics.

Return type:

Thruster

property maneuver_intervals

The maneuver intervals (for maneuver segments).

Type:

list[Interval]

property name

The name of the segment.

Type:

str

property segment_type

The type of the segment.

Type:

Type

property states

The states.

Type:

list[State]

class Type(self: ostk.astrodynamics.trajectory.Segment.Type, value: int)

Bases: pybind11_object

Segment type.

Members:

Coast : Coast

Maneuver : Maneuver

property name
static coast(name: ostk.core.type.String, event_condition: ostk::astrodynamics::EventCondition, dynamics: list[ostk::astrodynamics::Dynamics], numerical_solver: ostk.astrodynamics.trajectory.state.NumericalSolver) ostk.astrodynamics.trajectory.Segment

Create a coast segment.

Parameters:
Returns:

The coast segment.

Return type:

Segment

static constant_local_orbital_frame_direction_maneuver(name: ostk.core.type.String, event_condition: ostk::astrodynamics::EventCondition, thruster_dynamics: ostk::astrodynamics::dynamics::Thruster, dynamics: list[ostk::astrodynamics::Dynamics], numerical_solver: ostk.astrodynamics.trajectory.state.NumericalSolver, local_orbital_frame_factory: ostk.astrodynamics.trajectory.LocalOrbitalFrameFactory, maximum_allowed_angular_offset: ostk.physics.unit.Angle = Angle.undefined(), maneuver_constraints: ostk.astrodynamics.trajectory.Segment.ManeuverConstraints = ManeuverConstraints()) ostk.astrodynamics.trajectory.Segment

Create a maneuvering segment that produces maneuvers with a constant direction in the local orbital frame.

The provided thruster dynamics are used to solve the segment at first. The maneuvers produced by this segement solution are then used to create a new thruster dynamics with a constant direction in the local orbital frame. This new thruster dynamics is then used to actually solve the segment.

If defined, a runtime error will be thrown if the maximum allowed angular offset between the original thruster dynamics and the mean thrust direction is violated.

Parameters:
  • name (str) -- The name of the segment.

  • event_condition (EventCondition) -- The event condition.

  • thruster_dynamics (ThrusterDynamics) -- The thruster dynamics.

  • dynamics (Dynamics) -- The dynamics.

  • numerical_solver (NumericalSolver) -- The numerical solver.

  • local_orbital_frame_factory (LocalOrbitalFrameFactory) -- The local orbital frame factory.

  • maximum_allowed_angular_offset (Angle, optional) -- The maximum allowed angular offset to consider (if any). Defaults to Angle.undefined().

  • maneuver_constraints (ManeuverConstraints, optional) -- The maneuver constraints. Defaults to empty constraints.

Returns:

The maneuver segment.

Return type:

Segment

get_dynamics(
self: ostk.astrodynamics.trajectory.Segment,
) list[ostk::astrodynamics::Dynamics]

Get the dynamics.

Returns:

The dynamics.

Return type:

Dynamics

get_event_condition(
self: ostk.astrodynamics.trajectory.Segment,
) ostk::astrodynamics::EventCondition

Get the event condition.

Returns:

The event condition.

Return type:

EventCondition

get_free_dynamics(
self: ostk.astrodynamics.trajectory.Segment,
) list[ostk::astrodynamics::Dynamics]

Get the free dynamics array, devoid of any thruster dynamics.

Returns:

The free dynamics array.

Return type:

list[Dynamics]

get_maneuver_constraints(
self: ostk.astrodynamics.trajectory.Segment,
) ostk.astrodynamics.trajectory.Segment.ManeuverConstraints

Get the maneuver constraints.

Returns:

The maneuver constraints.

Return type:

ManeuverConstraints

get_name(self: ostk.astrodynamics.trajectory.Segment) ostk.core.type.String

Get the name of the segment.

Returns:

The name of the segment.

Return type:

str

get_numerical_solver(
self: ostk.astrodynamics.trajectory.Segment,
) ostk.astrodynamics.trajectory.state.NumericalSolver

Get the numerical solver.

Returns:

The numerical solver.

Return type:

NumericalSolver

get_thruster_dynamics(
self: ostk.astrodynamics.trajectory.Segment,
) ostk::astrodynamics::dynamics::Thruster

Get the thruster dynamics.

Returns:

The thruster dynamics.

Return type:

Thruster

get_type(
self: ostk.astrodynamics.trajectory.Segment,
) ostk.astrodynamics.trajectory.Segment.Type

Get the type of the segment.

Returns:

The type of the segment.

Return type:

Type

static maneuver(name: ostk.core.type.String, event_condition: ostk::astrodynamics::EventCondition, thruster_dynamics: ostk::astrodynamics::dynamics::Thruster, dynamics: list[ostk::astrodynamics::Dynamics], numerical_solver: ostk.astrodynamics.trajectory.state.NumericalSolver, maneuver_constraints: ostk.astrodynamics.trajectory.Segment.ManeuverConstraints = ManeuverConstraints()) ostk.astrodynamics.trajectory.Segment

Create a maneuver segment.

Parameters:
  • name (str) -- The name of the segment.

  • event_condition (EventCondition) -- The event condition.

  • thruster_dynamics (ThrusterDynamics) -- The thruster dynamics.

  • dynamics (Dynamics) -- The dynamics.

  • numerical_solver (NumericalSolver) -- The numerical solver.

  • maneuver_constraints (ManeuverConstraints, optional) -- The maneuver constraints. Defaults to empty constraints.

Returns:

The maneuver segment.

Return type:

Segment

solve(
self: ostk.astrodynamics.trajectory.Segment,
state: ostk.astrodynamics.trajectory.State,
maximum_propagation_duration: ostk.physics.time.Duration = Duration.days(30.0),
previous_maneuver_interval: ostk.physics.time.Interval = Interval.undefined(),
) ostk.astrodynamics.trajectory.Segment.Solution

Solve the segment until its event condition is satisfied or the maximum propagation duration is reached.

Parameters:
  • state (State) -- The state.

  • maximum_propagation_duration (Duration, optional) -- The maximum propagation duration. Defaults to 30 days.

  • previous_maneuver_interval (Interval, optional) -- The previous maneuver interval prior to this segment. Defaults to Interval.undefined().

Returns:

The segment solution.

Return type:

SegmentSolution

static string_from_maximum_maneuver_duration_violation_strategy(
strategy: ostk.astrodynamics.trajectory.Segment.MaximumManeuverDurationViolationStrategy,
) ostk.core.type.String

Get the string representation of a MaximumManeuverDurationViolationStrategy.

Parameters:

strategy (MaximumManeuverDurationViolationStrategy) -- The strategy.

Returns:

The string representation of the strategy.

Return type:

str