3. ScenarioSetup#

class ScenarioSetup(mission_sequence: MissionSequence, map_STM_to_t0: bool = False, atol_dv: float = 2.220446049250313e-14, rtol_dv: float = 2.220446049250313e-14)#

Bases: object

Manages the setup and propagation of a mission scenario.

This class is responsible for orchestrating the execution of a mission sequence, ensuring consistency in propagated states, epochs, and dynamical models. It interacts with the propagator to execute trajectory propagation while handling State Transition Matrices (STMs) and maneuver modeling.

Parameters:
  • mission_sequence (MissionSequence) – The mission sequence containing legs, burns, and associated state vectors.

  • map_STM_to_t0 (bool, optional) – Whether to map the STM (State Transition Matrix) to the initial state. Defaults to False.

  • atol_dv (float, optional) – Absolute tolerance for delta-v approximations. Defaults to 2.22e-14.

  • rtol_dv (float, optional) – Relative tolerance for delta-v approximations. Defaults to 1.

See also

scarabaeus.Propagator

the propagator that ScenarioSetup interacts with.

Notes

The ScenarioSetup class is designed to be compatible with the Propagator class. Any updates to propagation functionality should be reflected here.

Enforces mission constraints such as maximum numbers of legs and impulsive burns.

Attributes

STM_old

The last computed State Transition Matrix (STM).

atol

The absolute tolerance for numerical integration.

atol_dv

The absolute tolerance for delta-v approximations.

delta_v

The last computed impulsive delta-v, if applicable.

delta_v_approx_flag

Indicates whether an impulsive delta-v is approximated as a continuous force.

et_old

The last computed epoch in the mission sequence.

len_sequence

The total number of elements (legs + burns) in the mission sequence.

map_STM_to_t0

Indicates whether the STM should be mapped to the initial time.

mission_sequence

The mission sequence associated with this scenario.

propagator

The propagator responsible for trajectory calculations.

rtol

The relative tolerance for numerical integration.

rtol_dv

The relative tolerance for delta-v approximations.

segment_STMs

Maps segment names to STM arrays.

segment_epochsTDB

Maps segment names to epoch arrays.

segment_parameters

Maps segment names to parameter arrays.

segment_positions

Maps segment names to position arrays.

segment_velocities

Maps segment names to velocity arrays.

state_size_old

The size of the last computed state vector.

state_vector_old

The last computed state vector.

total_STMs

The total concatenated STM history.

total_epochsTDB

The total concatenated epochs for the scenario.

total_parameters

The total set of propagated parameters.

total_position

The total concatenated position history for the scenario.

total_velocity

The total concatenated velocity history for the scenario.

Methods

merge_state_list_with_old(new_list)

Merges a new state list with the existing state vector, preserving old values where applicable.

propagate()

Executes the propagation of the mission sequence through all defined legs and impulsive burns.

update_stm(new_list)

Updates the State Transition Matrix (STM) based on the new state vector.

merge_state_list_with_old(new_list: list) list#

Merges a new state list with the existing state vector, preserving old values where applicable.

Ensures that previously estimated state values remain unchanged when transitioning between sequence legs, replacing NaN values in the new list with corresponding values from the old state vector.

Parameters:

new_list (list) – List of state vector definitions for the new sequence leg.

Returns:

updated_states – Updated state vector list, merging previous values where applicable.

Return type:

list

propagate() None#

Executes the propagation of the mission sequence through all defined legs and impulsive burns.

Iterates through each segment of the mission sequence, handling trajectory legs and impulsive maneuvers. Initializes and configures the propagator for each leg, updates the state vector and State Transition Matrix (STM) as necessary, and ensures continuity across different segments.

Return type:

None

Notes

The propagation process consists of:

  1. Processing Legs:
    • Retrieves the corresponding epoch vector for the leg.

    • Updates the state vector, merging it with the previous leg’s state where necessary.

    • Updates the STM to reflect changes in the state vector.

    • Initializes the propagator for the leg with the updated state and STM.

    • Executes the numerical integration for the trajectory propagation.

    • Extracts position, velocity, estimated parameters, and STMs from the propagated data.

    • Ensures continuity by checking the transition between legs.

    • Stores results for later retrieval.

  2. Handling Impulsive Burns:
    • Retrieves and stores the impulsive velocity change (delta_v).

    • Updates flags indicating whether the maneuver should be modeled as an approximation.

    • Ensures proper handling of burns in sequence, preventing back-to-back impulsive burns.

    • Updates the stored state vector to reflect the new post-burn velocity.

  3. Data Storage and Consistency:
    • Stores propagated positions, velocities, parameters, and STMs.

    • Removes redundant values at segment boundaries to ensure epoch continuity.

    • Converts final position and velocity results into ArrayWUnits for consistency.

update_stm(new_list: list)#

Updates the State Transition Matrix (STM) based on the new state vector.

The STM is modified to reflect changes in the state vector, preserving mapping from previous states where necessary. If a dv_man term is present, the STM is adjusted to transition from an STM to an MTM (Maneuver Transition Matrix).

Parameters:

new_list (new_list) – The updated state vector list.

Returns:

updated_stms – The updated STM reflecting the new state vector.

Return type:

numpy.ndarray

property STM_old: ndarray#

The last computed State Transition Matrix (STM).

property atol: float#

The absolute tolerance for numerical integration.

property atol_dv: float#

The absolute tolerance for delta-v approximations.

property delta_v: ArrayWUnits | None#

The last computed impulsive delta-v, if applicable.

property delta_v_approx_flag: bool#

Indicates whether an impulsive delta-v is approximated as a continuous force. True if delta-v is approximated, otherwise False.

property et_old: EpochArray#

The last computed epoch in the mission sequence.

property len_sequence: int#

The total number of elements (legs + burns) in the mission sequence.

property map_STM_to_t0: bool#

Indicates whether the STM should be mapped to the initial time. True if the STM is mapped to the initial state, otherwise False.

property mission_sequence: MissionSequence#

The mission sequence associated with this scenario.

property propagator: Propagator#

The propagator responsible for trajectory calculations.

property rtol: float#

The relative tolerance for numerical integration.

property rtol_dv: float#

The relative tolerance for delta-v approximations.

property segment_STMs: dict#

Maps segment names to STM arrays.

property segment_epochsTDB: dict#

Maps segment names to epoch arrays.

property segment_parameters: dict#

Maps segment names to parameter arrays.

property segment_positions: dict#

Maps segment names to position arrays.

property segment_velocities: dict#

Maps segment names to velocity arrays.

property state_size_old: int#

The size of the last computed state vector.

property state_vector_old: StateArray#

The last computed state vector.

property total_STMs: list[ndarray]#

The total concatenated STM history.

property total_epochsTDB: EpochArray#

The total concatenated epochs for the scenario. Times given in Barycentric Dynamical Time (TDB).

property total_parameters: list[ArrayWUnits]#

The total set of propagated parameters.

property total_position: ArrayWUnits#

The total concatenated position history for the scenario. Expressed in units of kilometers.

property total_velocity: ArrayWUnits#

The total concatenated velocity history for the scenario. Expressed in units of \(\frac{km}{s}\).