# environment#

Functionalities of environment objects.

This module provides functionalities for environment objects. Specifically, it contains classes and functions that perform computations related to environment models of natural and artificial bodies. Much of the functionality in this module concerns classes stored inside Body objects, a list of which is in turn stored in a SystemOfBodies object. Note that the classes in this module are rarely created manually, but are instead created by the functionality in the environment_setup module.

## Functions#

 save_vehicle_mesh_to_file(...[, ...]) Function to save the mesh used for a hypersonic local inclination analysis to a file.
save_vehicle_mesh_to_file(local_inclination_analysis_object: tudatpy.kernel.numerical_simulation.environment.HypersonicLocalInclinationAnalysis, output_directory: str, output_file_prefix: str = '') None#

Function to save the mesh used for a hypersonic local inclination analysis to a file.

Function to save the mesh used for a hypersonic local inclination analysis to a file. This function saves two files to the specified directory, with filenames: “ShapeFile.dat” and “SurfaceNormalFile.dat”, where these files names may be prefixed by an optional string (see below). The first of these files contains four columns defining the surface points that define mesh, with Column 0: point index; Column 1: x-position of point; Column 1: y-position of point; Column 2: z-position of point. The second file contains four columns with Column 0: point index; Column 1: x-component of surface normal; Column 1: y-position of surface normal; Column 2: z-position of surface normal.

Parameters:
• local_inclination_analysis_object (HypersonicLocalInclinationAnalysis) – Object used to calculate the aerodynamics of the vehicle

• output_directory (str) – Directory to which the files are to be saved

• output_file_prefix (str, default='') – Optional prefix of output file names

## Enumerations#

 AerodynamicsReferenceFrames Enumeration of reference frame identifiers typical for aerodynamic calculations. AerodynamicCoefficientsIndependentVariables Enumeration of the independent variables that can be used to compute aerodynamic coefficients.
class AerodynamicsReferenceFrames#

Enumeration of reference frame identifiers typical for aerodynamic calculations.

Enumeration of reference frame identifiers typical for aerodynamic calculations. Note that the frames are also defined in the absence of any aerodynamic forces and/or atmosphere. They define frames of a body w.r.t. a central body, with the details given by Mooij (1994). The chain of frames starts from the inertial frame, to the frame fixed to the central body (corotating), to the vertical frame (defined by the body’s relative position), the trajectory and aerodynamic frames (defined by the body’s relative velocity) and finally the body’s own body-fixed frame.

Members:

inertial_frame :

corotating_frame :

vertical_frame :

trajectory_frame :

aerodynamic_frame :

body_frame :

property name#
class AerodynamicCoefficientsIndependentVariables#

Enumeration of the independent variables that can be used to compute aerodynamic coefficients.

Members:

mach_number_dependent :

Mach number of the propagated vehicle.

angle_of_attack_dependent :

Angle of attack of the propagated vehicle.

sideslip_angle_dependent :

Sideslip angle of the propagated vehicle.

altitude_dependent :

Altitude of the propagated vehicle.

time_dependent :

Current simulation epoch.

control_surface_deflection_dependent :

Angle of deflection of the control surface of the propagated vehicle.

undefined_independent_variable :

Can be used for a custom coefficient interface with other variables, at the expense of being able to use the FlightConditions class to automatically updates the aerodynamic coefficients during propagation.

property name#

## Classes#

 HypersonicLocalInclinationAnalysis FlightConditions Object that calculates various state-derived quantities typically relevant for flight dynamics. AtmosphericFlightConditions Object that calculates various state-derived quantities typically relevant for flight dynamics, for flight in an atmosphere. AerodynamicAngleCalculator Object to calculate (aerodynamic) orientation angles, and frame transformations, from current vehicle state. Body Object that stores the environment properties and current state of a single body. SystemOfBodies Object that contains a set of Body objects and associated frame information.
class HypersonicLocalInclinationAnalysis#
__init__(self: tudatpy.kernel.numerical_simulation.environment.HypersonicLocalInclinationAnalysis, independent_variable_points: List[List[float]], body_shape: tudatpy.kernel.math.geometry.SurfaceGeometry, number_of_lines: List[int], number_of_points: List[int], invert_orders: List[bool], selected_methods: List[List[int]], reference_area: float, reference_length: float, moment_reference_point: numpy.ndarray[numpy.float64[3, 1]], save_pressure_coefficients: bool = False) None#

Class constructor, taking the shape of the vehicle, and various analysis options as input.

Parameters:
• independent_variable_points (list[list[float]]) – List containing three lists, with each sublist containing the data points of each of the independent variables for the coefficient generation. The physical meaning of each of the three independent variables is: 0 = mach number, 1 = angle of attack, 2 = angle of sideslip. Each of the subvectors must be sorted in ascending order.

• body_shape (SurfaceGeometry) – Class that defines the shape of the vehicle as a continuous surface. The local inclination analysis discretizes the surface of the vehicle into quadrilateral panels, defined by the other inputs to this constructor. In case the tudat.geometry.SurfaceGeometry object is made up of multiple sub-shapes, different settings may be used for each

• number_of_lines (List[ float ]) – Number of discretization points in the first independent surface variable of each of the subparts of body_shape. The size of this list should match the number of parts of which the body_shape is composed. The first independent variable of a subpart typically runs along the longitudinal vehicle direction

• number_of_points (List[ float ]) – Number of discretization points in the second independent surface variable of each of the subparts of body_shape. The size of this list should match the number of parts of which the body_shape is composed. The first independent variable of a subpart typically runs along the lateral vehicle direction

• invert_orders (List[ bool ]) – Booleans to denote whether the surface normals of the panels of each discretized body_shape subpart are to be inverted (i.e. inward-facing->outward facing or vice versa). The size of this list should match the number of parts of which the body_shape is composed.

• selected_methods (List[ List[ int ] ]) – Double list of selected local inclination methods, the first index (outer list) represents compression or expansion (0 and 1), the second index (inner list) denotes the vehicle part index. The size of this inner list should match the number of parts of which the body_shape is composed. The int defining the method type is interpreted as follows. For the compression methods, the following are available: * 0: Newtonian Method. * 1: Modified Newtonian. * 2 and 3: not available at this moment. * 4: Tangent-wedge method. * 5: Tangent-cone method. * 6: Modified Dahlem-Buck method. * 7: VanDyke unified pressure method. * 8: Smyth Delta Wing method. * 9: Hankey flat surface method The expansion method has the following options: * 0: Vacuum Pressure coefficient method. * 1: Zero Pressure function. * 4: High Mach base pressure method. * 3 or 5: Prandtl-Meyer method. * 6: ACM empirical pressure coefficient.

• reference_area (float) – Reference area used to non-dimensionalize aerodynamic forces and moments.

• moment_reference_point (numpy.ndarray) – Reference point wrt which aerodynamic moments are calculated.

• save_pressure_coefficients (Bool) – Boolean denoting whether to save the pressure coefficients that are computed to files

clear_data(self: tudatpy.kernel.numerical_simulation.environment.HypersonicLocalInclinationAnalysis) None#
class FlightConditions#

Object that calculates various state-derived quantities typically relevant for flight dynamics.

Object that calculates various state-derived quantities typically relevant for flight dynamics, such as latitude, longitude, altitude, etc. It also contains an AerodynamicAngleCalculator that computes derived angles (flight path, heading angle, etc.). This object is limited to non-atmospheric flight. For flight through Body objects endowed with an atmosphere model, the derived class AtmosphericFlightConditions is used. This object is stored inside a Body object, and represents the flight conditions of a single body w.r.t. a single central body.

update_conditions(self: tudatpy.kernel.numerical_simulation.environment.FlightConditions, current_time: float) None#
property aerodynamic_angle_calculator#

The object that is responsible for computing various relevant flight dynamics angles and frame rotations.

Type:

AerodynamicAngleCalculator

property altitude#

The current time, at which this object was last updated

Type:

float

property body_centered_body_fixed_state#

Cartesian translational state, expressed in a frame centered at, and fixed to, the central body. Note that, due to the rotation of the central body, the norm of the body-fixed, body-centered, velocity differs from the norm of the inertial body-centered velocity.

Type:

numpy.ndarray

property geodetic_latitude#

The body-fixed geographic latitude of the body w.r.t. its central body.

Type:

float

property longitude#

The body-fixed longitude of the body w.r.t. its central body.

Type:

float

property time#

The current time, at which this object was last updated

Type:

float

class AtmosphericFlightConditions#

Object that calculates various state-derived quantities typically relevant for flight dynamics, for flight in an atmosphere.

Object that calculates various state-derived quantities typically relevant for flight dynamics, for flight in an atmosphere, such as latitude, longitude, altitude, density, Mach number etc. It also contains an AerodynamicAngleCalculator that computes derived angles (flight path, heading angle, etc.). This object is derived from FlightConditions, which performs computations for non-atmospheric flight only. This object is stored inside a Body object, and represents the flight conditions of a single body w.r.t. a single central body.

property aero_coefficient_independent_variables#

List of current values of independent variables of aerodynamic coefficients. This list is only defined if the body has an AerodynamicCoefficientInterface that has dependencies on environmental variables (e.g. Mach number, angle of attack, etc.).

Type:

numpy.ndarray

property aerodynamic_coefficient_interface#

Object extracted from the same Body object as this AtmosphericFlightConditions object, which defines the aerodynamic coefficients.

Type:

AerodynamicCoefficientInterface

property airspeed#

The airspeed of the body w.r.t. the atmosphere.

Type:

float

property airspeed_velocity#

The velocity vector of the body w.r.t. the freestream atmosphere (e.g. vectorial counterpart of airspeed).

Type:

numpy.ndarray

property control_surface_aero_coefficient_independent_variables#

List of lists current values of independent variables of aerodynamic coefficients for control surfaces. The outer list defines the control surface, the inner list the values of the independent variables. This list is only defined if the body has an AerodynamicCoefficientInterface with control surfaces that have dependencies on environmental variables (e.g. Mach number, angle of attack, etc.).

Type:

numpy.ndarray

property density#

The freestream atmospheric density at the body’s current location.

Type:

float

property dynamic_pressure#

The freestream atmospheric dynamic pressure at the body’s current location.

Type:

float

property mach_number#

The freestream Mach number of the body.

Type:

float

property pressure#

The freestream atmospheric static pressure at the body’s current location.

Type:

float

property speed_of_sound#

The freestream atmospheric speed of sound at the body’s current location.

Type:

float

property temperature#

The freestream atmospheric temperature at the body’s current location.

Type:

float

class AerodynamicAngleCalculator#

Object to calculate (aerodynamic) orientation angles, and frame transformations, from current vehicle state.

Object to calculate (aerodynamic) orientation angles (list given by the AerodynamicsReferenceFrameAngles enum) and transformations between frames (list given by the AerodynamicsReferenceFrames enum) from current vehicle state.

get_angle(self: tudatpy.kernel.numerical_simulation.environment.AerodynamicAngleCalculator, angle_type: tudatpy.kernel.numerical_simulation.environment.AerodynamicsReferenceFrameAngles) #

Function to get a single orientation angle

Function to get a single orientation angle. This function is meant to be used only during a numerical propagation, in particular for the definition of a custom (e.g. guidance) model.

Parameters:

original_frame (AerodynamicsReferenceFrameAngles) – The identifier for the angle that is to be returnd

Returns:

Value of requested angle

Return type:

double

get_rotation_matrix_between_frames(self: tudatpy.kernel.numerical_simulation.environment.AerodynamicAngleCalculator, original_frame: tudatpy.kernel.numerical_simulation.environment.AerodynamicsReferenceFrames, target_frame: tudatpy.kernel.numerical_simulation.environment.AerodynamicsReferenceFrames) numpy.ndarray[numpy.float64[3, 3]]#

Function to get the rotation matrix between two frames.

Function to get the rotation matrix between two frames. This function is meant to be used only during a numerical propagation, in particular for the definition of a custom (e.g. guidance) model.

Parameters:
Returns:

Rotation matrix $$\mathbf{R}^{B/A}$$ from frame $$A$$ to frame B

Return type:

np.ndarray

set_body_orientation_angle_functions(self: tudatpy.kernel.numerical_simulation.environment.AerodynamicAngleCalculator, angle_of_attack_function: Callable[[], float] = None, angle_of_sideslip_function: Callable[[], float] = None, bank_angle_function: Callable[[], float] = None, angle_update_function: Callable[[float], None] = None, silence_warnings: bool = False) None#
set_body_orientation_angles(self: tudatpy.kernel.numerical_simulation.environment.AerodynamicAngleCalculator, angle_of_attack: float = nan, angle_of_sideslip: float = nan, bank_angle: float = nan, silence_warnings: bool = False) None#
class Body#

Object that stores the environment properties and current state of a single body.

Object that stores the environment properties and current state of a single celestial body (natural or artificial). Each separate environment model (gravity field, ephemeris, etc.) is stored as a member object in this class. During each time step, the Body gets updated to the current time/propagated state, and the current properties, in as much as they are time-dependent, can be extracted from this object

get_ground_station(self: tudatpy.kernel.numerical_simulation.environment.Body, station_name: str) tudatpy.kernel.numerical_simulation.environment.GroundStation#
set_constant_mass(self: tudatpy.kernel.numerical_simulation.environment.Body, mass: float) None#
state_in_base_frame_from_ephemeris(self: tudatpy.kernel.numerical_simulation.environment.Body, time: float) numpy.ndarray[numpy.float64[6, 1]]#
property aerodynamic_coefficient_interface#

Object defining the aerodynamic coefficients of a vehicle (force-only, or force and moment) as a function of any number of independent variables. Depending on the selected type of model, the type of this attribute is of type AerodynamicCoefficientInterface, or a derived class thereof.

Type:

AerodynamicCoefficientInterface

property atmosphere_model#

Atmosphere model of this body, used to calculate density, temperature, etc. at a given state/time. Depending on the selected type of model, the type of this attribute is of type AtmosphereModel, or a derived class thereof.

Type:

AtmosphereModel

property body_fixed_angular_velocity#

Angular velocity vector of the body, expressed in body-fixed frame (see inertial_to_body_fixed_frame).

Type:

numpy.ndarray

property body_fixed_to_inertial_frame#

The rotation from this Body’s body-fixed frame to inertial frame (see inertial_to_body_fixed_frame).

Type:

numpy.ndarray

property body_fixed_to_inertial_frame_derivative#

Time derivative of rotation matrix from this Body’s body-fixed frame to inertial frame (see inertial_to_body_fixed_frame).

Type:

numpy.ndarray

property ephemeris#

Ephemeris model of this body, used to calculate its current state as a function of time. Depending on the selected type of model, the type of this attribute is of type Ephemeris, or a derived class thereof.

Type:

Ephemeris

property gravitational_parameter#

Attribute of convenience, equivalent to .gravity_field_model.gravitational_parameter

Type:

float

property gravity_field_model#

Gravity field model of this body, used to define the exterior gravitational potential, and its gradient(s). Depending on the selected type of model, the type of this attribute is of type GravityFieldModel, or a derived class thereof.

Type:

GravityFieldModel

property inertial_angular_velocity#

Angular velocity vector of the body, expressed in inertial frame (see inertial_to_body_fixed_frame).

Type:

numpy.ndarray

property inertial_to_body_fixed_frame#

The rotation from inertial frame (with global frame orientation) to this Body’s body-fixed frame. The rotation is always returned here as a rotation matrix. If the body’s rotational state is numerically propagated, this property gets extracted from the propagated state vector. If it is not propagated, the state is extracted from this body’s rotational ephemeris.

Note

This function is only valid during the numerical propagation if any aspects of the dynamics or dependent variables require the body’s rotational state.

Type:

numpy.ndarray

property inertial_to_body_fixed_frame_derivative#

Time derivative of rotation matrix from inertial frame to this Body’s body-fixed frame (see inertial_to_body_fixed_frame).

Type:

numpy.ndarray

property mass#

Denotes the current mass of the vehicle, as used in the calculation of non-conservative acceleration. Note that defining a mass for a vehicle does not define a gravity field (this is done through a gravity field model). However, defining a gravity field model in a body automatically assigns it a mass here. Unlike the attributes containing the state, orientation, angular velocity of the Body, this attribute may be used to retrieve the state during the propagation and to define the mass of a vehicle

Type:

float

property position#

The translational position of the Body, as set during the current step of the numerical propagation (see state).

Type:

numpy.ndarray

property rotation_model#

Object defining the orientation of a body, used to calculate the rotation to/from a body-fixed frame (and its derivate). Depending on the selected type of model, the type of this attribute is of type RotationalEphemeris, or a derived class thereof.

Type:

RotationalEphemeris

property shape_model#

Shape model of this body, used to define the exterior shape of the body, for instance for the calculation of vehicle’s altitude. Depending on the selected type of model, the type of this attribute is of type BodyShapeModel, or a derived class thereof.

Type:

BodyShapeModel

property state#

The translational state of the Body, as set during the current step of the numerical propagation. The translational state stored here is always in Cartesian elements, w.r.t. the global frame origin, with axes along the global frame orientation. If the body’s translational state is numerically propagated, this property gets extracted from the propagated state vector. If it is not propagated, the state is extracted from this body’s ephemeris. In both cases, any required state transformations are automatically applied. Note that this function is only valid during the numerical propagation if any aspects of the dynamics or dependent variables require the body’s state.

Type:

numpy.ndarray

property velocity#

The translational velocity of the Body, as set during the current step of the numerical propagation (see state).

Type:

numpy.ndarray

class SystemOfBodies#

Object that contains a set of Body objects and associated frame information.

Object that contains a set of Body objects and associated frame information. This object stored the entire environment for a typical Tudat numerical simulation, and is fundamental for the overall Tudat architecture.

This function adds an existing body, which the user has separately created, to the SystemOfBodies.

Parameters:

• body_name (numpy.ndarray) – Name of the Body that is to be added.

• process_body (bool, default=True) –

Variable that defines whether this new Body will have its global frame origin/orientation set to conform to rest of the environment.

Warning

Only in very rare cases should this variable be anything other than True. Users are recommended to keep this default value intact.

create_empty_body(self: tudatpy.kernel.numerical_simulation.environment.SystemOfBodies, body_name: str, process_body: bool = 1) None#

This function creates a new empty body.

This function creates a new empty body, and adds it to the SystemOfBodies. Since the body is empty, it will not have any environment models defined. These must all be added manually by a user.

Parameters:
• body_name (string) – Name of the Body that is to be added

• process_body (bool, default=True) –

Variable that defines whether this new Body will have its global frame origin/orientation set to conform to rest of the environment.

Warning

Only in very rare cases should this variable be anything other than True. Users are recommended to keep this default value intact.

Examples

This function is often used early on in the environment creation segment of a simulation, following the creation of a SystemOfBodies from the default settings for celestial bodies.

# Define string names for bodies to be created from default.
bodies_to_create = ["Sun", "Earth", "Moon", "Mars", "Venus"]

# Use "Earth"/"J2000" as global frame origin and orientation.
global_frame_origin = "Earth"
global_frame_orientation = "J2000"

# Create default body settings, usually from spice.
body_settings = environment_setup.get_default_body_settings(
bodies_to_create,
global_frame_origin,
global_frame_orientation)

# Create system of selected celestial bodies
bodies = environment_setup.create_system_of_bodies(body_settings)

# Create vehicle objects.
bodies.create_empty_body("Delfi-C3")

get(self: tudatpy.kernel.numerical_simulation.environment.SystemOfBodies, body_name: str) #

This function extracts a single Body object from the SystemOfBodies.

Parameters:

body_name (numpy.ndarray) – Name of the Body that is to be retrieved.

Returns:

Body object of the requested name

Return type:

Body

get_body(self: tudatpy.kernel.numerical_simulation.environment.SystemOfBodies, body_name: str) #

Deprecated version of get()

remove_body(self: tudatpy.kernel.numerical_simulation.environment.SystemOfBodies, body_name: str) None#

This function removes an existing body from the SystemOfBodies.

Warning

This function does not necessarily delete the Body object, it only removes it from this object. If any existing models in the simulation refer to this Body, it will persist in memory.

Parameters:

body_name (numpy.ndarray) – Name of the Body that is to be removed.