latom.nlp.nlp_heo_2d¶
@authors: Alberto FOSSA’ Giuliana Elena MICELI
Classes
|
MultiPhaseNLP transcribes a continuous-time optimal control problem in trajectory optimization constituted by multiple phases into a Non Linear Programming Problem (NLP) using the libraries OpenMDAO and dymos. |
|
ODE2dLLO2Apo class defines the equations of motion for a two dim. |
|
ODE2dLLO2HEO class defines the equations of motion for a two dim. |
|
TwoDim3PhasesLLO2HEOGuess provides an initial guess for a LLO to HEO transfer trajectory subdivided into two powered phases and an intermediate coasting phase. |
|
TwoDim3PhasesLLO2HEONLP transcribes an optimal control problem for a three-phases ascent trajectory from a circular Low Lunar Orbit (LLO) to an Highly Elliptical Orbit (HEO) into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries. |
|
TwoDimLLO2HEONLP transcribes a continuous-time optimal control problem for a two-dimensional transfer trajectory from a Low Lunar Orbit (LLO) to an Highly Elliptical Orbit (HEO) into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries. |
|
TwoDimLLO2HEOGuess provides an initial guess for an LLO to HEO transfer. |
|
TwoDimLLO2HEONLP transcribes a continuous-time optimal control problem for a two-dimensional transfer trajectory from a Low Lunar Orbit (LLO) to an Highly Elliptical Orbit (HEO) into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries. |
|
TwoDimNLP class transcribes a two-dimensional, continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries. |
|
TwoDimVarNLP class transcribes a two-dimensional, continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries. |
-
class
latom.nlp.nlp_heo_2d.TwoDimLLO2HEONLP(body, sc, alt, rp, t, alpha_bounds, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, check_partials=False, u_bound='lower', fix_final=True)[source]¶ Bases:
latom.nlp.nlp_2d.TwoDimVarNLPTwoDimLLO2HEONLP transcribes a continuous-time optimal control problem for a two-dimensional transfer trajectory from a Low Lunar Orbit (LLO) to an Highly Elliptical Orbit (HEO) into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The transfer is modeled as a single phase ascent trajectory from the departure LLO to the apoapsis of the arrival HEO. The thrust magnitude is allowed to vary over time.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – LLO altitude [m]
rp (float) – HEO periapsis radius [m]
t (float) – HEO period [s]
alpha_bounds (tuple) – Lower and upper bounds on thrust vector direction [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or
None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default isNonerec_file (str or
None, optional) – Name of the file in which the computed solution is recorded orNone. Default isNonecheck_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falseu_bound (str or
None, optional) – Bounds on spacecraft radial velocity betweenlowerandupperorNone. Default islowerfix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isTrue
-
set_states_options(theta, u_bound=None)[source]¶ Set the states variables options.
- Parameters
theta (float) – Unit reference value for spawn angle [rad]
u_bound (str or
None, optional) – Bounds on spacecraft radial velocity betweenlowerandupperorNone. Default islower
-
cleanup()¶ Clean up resources.
-
exp_sim(rec_file=None)¶ Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_controls_options(throttle=True)¶ Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess(check_partials=False, fix_final=False, throttle=True)¶ Set the initial guess for the iterative solution of the NLP.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True)¶ Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_objective()¶ Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_options(theta, t_bounds, u_bound=None)¶ Set options on state and control variables, time and objective function.
- Parameters
theta (float) – Guessed spawn angle [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_time_guess(tof)¶ Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds)¶ Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup()¶ Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_heo_2d.TwoDimLLO2ApoNLP(body, sc, alt, rp, t, alpha_bounds, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, check_partials=False, params=None)[source]¶ Bases:
latom.nlp.nlp_2d.TwoDimNLPTwoDimLLO2HEONLP transcribes a continuous-time optimal control problem for a two-dimensional transfer trajectory from a Low Lunar Orbit (LLO) to an Highly Elliptical Orbit (HEO) into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The transfer is modeled as a single phase ascent trajectory from the departure LLO to the apoapsis of the arrival HEO. The thrust magnitude is allowed to vary over time.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – LLO altitude [m]
rp (float) – HEO periapsis radius [m]
t (float) – HEO period [s]
alpha_bounds (tuple) – Lower and upper bounds on thrust vector direction [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or
None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default isNonerec_file (str or
None, optional) – Name of the file in which the computed solution is recorded orNone. Default isNonecheck_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falseparams (dict or
None, optional) – Optional parameters to be passed when a continuation method is employed and the NLP guess is not defined orNone. Default isNone
- Variables
guess (TwoDimLLO2HEOGuess or
None) – Initial guess orNoneif continuation is used
-
add_timeseries_output(names=('a', 'eps', 'h'))[source]¶ Adds the semi-major axis, specific energy and specific angular momentum magnitude to the time series outputs of the phase.
- Parameters
names (iterable) – List of strings corresponding to the names of the variables to be added to the outputs
-
set_options(rp, vp, thetaf, tof, t_bounds=None)[source]¶ Set the states, controls and time options, add the design parameters and boundary constraints, define the objective of the optimization.
- Parameters
rp (float) – Unit reference value for lengths [m]
vp (float) – Unit reference value for velocities [m/s]
thetaf (float) – Unit reference value for spawn angle [rad]
tof (float) – Guessed time of flight [s]
t_bounds (iterable or
None, optional) – Time of flight lower and upper bounds expressed as fraction of tof [-]
-
set_initial_guess(check_partials=False, fix_final=False, throttle=False)[source]¶ Set the initial guess for a single solution or the first solution of a continuation procedure.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Trueof variable thrust,Falseotherwise
-
set_continuation_guess(tof, states, controls, check_partials=False)[source]¶ Set the initial guess for the solution
k+1as the optimal transfer found for the solutionkduring a continuation procedure.- Parameters
tof (float) – Time of flight for the previous optimal solution [s]
states (ndarray) – States on the states discretization nodes for the previous optimal solution
controls (ndarray) – Controls on the controls discretization nodes for the previous optimal solution
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
False
-
cleanup()¶ Clean up resources.
-
exp_sim(rec_file=None)¶ Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_controls_options(throttle=True)¶ Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True)¶ Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_objective()¶ Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_states_options(theta, u_bound=None)¶ Set options on the state variables of the NLP.
- Parameters
theta (float) – Reference value for spawn angle [rad]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_time_guess(tof)¶ Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds)¶ Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup()¶ Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_heo_2d.TwoDim3PhasesLLO2HEONLP(body, sc, alt, rp, t, alpha_bounds, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, check_partials=False)[source]¶ Bases:
latom.nlp.nlp.MultiPhaseNLPTwoDim3PhasesLLO2HEONLP transcribes an optimal control problem for a three-phases ascent trajectory from a circular Low Lunar Orbit (LLO) to an Highly Elliptical Orbit (HEO) into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The transfer is modeled with a first powered phase at maximum thrust to leave the initial LLO, and intermediate coasting phase and a second powered phase to inject in the target HEO.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – Periselene altitude at which the powered descent is initiated [m]
rp (float) – HEO periapsis radius [m]
t (float) – HEO period [s]
alpha_bounds (iterable) – Lower and upper bounds on thrust vector direction [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int or tuple) – Number of segments in which each phase is discretized
order (int or tuple) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (tuple) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
False
- Variables
guess (TwoDim3PhasesLLO2HEOGuess) – Initial guess for the iterative NLP solution
tof_adim (ndarray) – Time of flight in non-dimensional units [-]
-
set_initial_guess_phase(state_nodes, control_nodes, phase_name)[source]¶ Set the initial guess for a given Phase.
- Parameters
state_nodes (ndarray) – Indexes corresponding to the states discretization nodes within the specified transcription
control_nodes (ndarray) – Indexes corresponding to the controls discretization nodes within the specified transcription
phase_name (str) – Name of the current Phase object
-
cleanup()¶ Clean up resources.
-
exp_sim(rec_file=None)¶ Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_time_phase(ti, tof, phase, phase_name)¶ Compute the time grid within one phase to retrieve the time instants corresponding to the state, control and all discretization nodes.
- Parameters
ti (float) – Initial time [-]
tof (float) – Time of flight (TOF) [-]
phase (Phase) – Current phase
phase_name (str) – Current phase name
- Returns
state_nodes (ndarray) – Indexes corresponding to the state discretization nodes
control_nodes (ndarray) – Indexes corresponding to the control discretization nodes
t_state (ndarray) – Time instants on the state discretization nodes [-]
t_control (ndarray) – Time instants on the control discretization nodes [-]
t_all (ndarray) – Time instants on all discretization nodes [-]
-
setup()¶ Set up the Jacobian type, linear solver and derivatives type.