Main Content

Simple Variable Mass 6DOF ECEF (Quaternion)

Implement quaternion representation of six-degrees-of-freedom equations of motion of simple variable mass in Earth-centered Earth-fixed (ECEF) coordinates

  • Simple Variable Mass 6DOF ECEF (Quaternion) block

Libraries:
Aerospace Blockset / Equations of Motion / 6DOF

Description

The Simple Variable Mass 6DOF ECEF (Quaternion) block implements a quaternion representation of six-degrees-of-freedom equations of motion of simple variable mass in Earth-centered Earth-fixed (ECEF) coordinates. It considers the rotation of an Earth-centered Earth-fixed (ECEF) coordinate frame (XECEF, YECEF, ZECEF) about an Earth-centered inertial (ECI) reference frame (XECI, YECI, ZECI). The origin of the ECEF coordinate frame is the center of the Earth. For more information on the ECEF coordinate frame, see Algorithms.

Aerospace Blockset™ uses quaternions that are defined using the scalar-first convention.

Limitations

  • This implementation assumes that the applied forces are acting at the center of gravity of the body.

  • This implementation generates a geodetic latitude that lies between ±90 degrees, and longitude that lies between ±180 degrees. Additionally, the MSL altitude is approximate.

  • The Earth is assumed to be ellipsoidal. By setting flattening to 0.0, a spherical planet can be achieved. The Earth's precession, nutation, and polar motion are neglected. The celestial longitude of Greenwich is Greenwich Mean Sidereal Time (GMST) and provides a rough approximation to the sidereal time.

  • The implementation of the ECEF coordinate system assumes that the origin is at the center of the planet, the x-axis intersects the Greenwich meridian and the equator, the z-axis is the mean spin axis of the planet, positive to the north, and the y-axis completes the right-hand system.

  • The implementation of the ECI coordinate system assumes that the origin is at the center of the planet, the x-axis is the continuation of the line from the center of the Earth toward the vernal equinox, the z-axis points in the direction of the mean equatorial plane's north pole, positive to the north, and the y-axis completes the right-hand system.

Ports

Input

expand all

Force applied to the center of mass in the body frame, specified as a three-element vector, in the units specified in Units.

Data Types: double

Moment applied to the body with respect to center of mass in the body frame, specified as a three-element vector, in the units specified in Units.

Data Types: double

One or more rates of change of mass (positive if accreted, negative if ablated), specified as a scalar

Data Types: double

Greenwich meridian initial celestial longitude angle, specified as a scalar.

Dependencies

To enable this port

  • Set Celestial longitude of Greenwich to External.

  • set Planet model to Earth.

Data Types: double

Prime meridian initial celestial longitude angle, specified as a scalar.

Dependencies

To enable this port

  • Set Celestial longitude of prime meridian to External.

  • Set Planet model to Custom.

Data Types: double

One or more relative velocities at which the mass is accreted to or ablated from the body in body-fixed axes, specified as a three-element vector.

Dependencies

To enable this port, select Include mass flow relative velocity.

Data Types: double

Output

expand all

Velocity of body with respect to fixed frame in fixed-frame axes, expressed in fixed-frame axes, returned as a three-element vector.

Data Types: double

Position in fixed-frame, returned as a 3-element vector.

Data Types: double

Position in geodetic latitude, longitude, and altitude, in degrees, returned as a three-element vector or M-by-3 array, in selected units of length, respectively.

Data Types: double

Euler rotation angles for the x, y, z axes [roll, pitch, yaw], as a three-element vector, in radians. Yaw, pitch, and roll angles are applied using the z-y-x right-hand intrinsic passive transformation from frame A to frame B, such as angle2dcm(yaw,pitch,roll,"ZYX").

Data Types: double

Direction cosine matrix representing the coordinate transformation from inertial to body-fixed axes, returned as a 3-by-3 matrix.

Data Types: double

Direction cosine matrix representing the coordinate transformation from NED axes to body-fixed axes, returned as a 3-by-3 matrix.

Data Types: double

Direction cosine matrix representing the coordinate transformation from fixed-frame axes to NED axes, returned as a 3-by-3 matrix.

Data Types: double

Velocity of body with respect to fixed-frame in body-fixed axes, expressed in body-fixed axes, returned as a three-element vector.

Data Types: double

Relative angular rates of body with respect to NED frame, expressed in body frame and returned as a three-element vector, in radians per second.

Data Types: double

Angular rates of the body with respect to inertial frame, expressed in body frame and returned as a three-element vector, in radians per second.

Data Types: double

Angular accelerations of the body with respect to inertial frame, expressed in body frame and returned as a three-element vector, in radians per second squared.

Data Types: double

Acceleration of body with respect to body-fixed frame in body-fixed axes, returned as a three-element vector.

Data Types: double

Fuel tank status, returned as:

  • 1 — Tank is full.

  • 0 — Tank is neither full nor empty.

  • -1 — Tank is empty.

Data Types: double

Acceleration of body with respect to inertial frame in body-fixed axes, returned as a three-element vector.

Dependencies

To enable this point, select Include inertial acceleration.

Data Types: double

Parameters

expand all

Main

Input and output units, specified as Metric (MKS), English (Velocity in ft/s), or English (Velocity in kts).

UnitsForcesMomentAccelerationVelocityPositionMassInertia
Metric (MKS) NewtonNewton-meterMeters per second squaredMeters per secondMetersKilogramKilogram meter squared
English (Velocity in ft/s) PoundFoot-poundFeet per second squaredFeet per secondFeetSlugSlug foot squared
English (Velocity in kts) PoundFoot-poundFeet per second squaredKnotsFeetSlugSlug foot squared

Programmatic Use

Block Parameter: units
Type: character vector
Values: Metric (MKS) | English (Velocity in ft/s) | English (Velocity in kts)
Default: Metric (MKS)

Mass type, specified as:

Fixed

Mass is constant throughout the simulation (see 6DOF ECEF (Quaternion)).

Simple Variable

Mass and inertia vary linearly as a function of mass rate.

Custom Variable

Mass and inertia variations are customizable (see Custom Variable Mass 6DOF ECEF (Quaternion)).

The Simple Variable selection conforms to the previously described equations of motion.

Programmatic Use

Block Parameter: mtype
Type: character vector
Values: 'Fixed' | 'Simple Variable' | 'Custom Variable'
Default: 'Simple Variable'

Initial location of the rigid body in the geodetic reference frame, specified as a three-element vector. Latitude and longitude values can be any value. However, latitude values of +90 and -90 may return unexpected values because of singularity at the poles.

Programmatic Use

Block Parameter: xg_0
Type: character vector
Values: '[0 0 0]' | three-element vector
Default: '[0 0 0]'

Initial velocity of the body with respect to the ECEF frame, expressed in the body frame, specified as a three-element vector.

Programmatic Use

Block Parameter: Vm_0
Type: character vector
Values: '[0 0 0]' | three-element vector
Default: '[0 0 0]'

Initial Euler orientation angles [roll, pitch, yaw], specified as a three-element vector, in radians. Specify roll, pitch, and yaw angles in the z-y-x rotation sequence.

Programmatic Use

Block Parameter: eul_0
Type: character vector
Values: '[0 0 0]' | three-element vector
Default: '[0 0 0]'

Initial body-fixed angular rates with respect to the NED frame, specified as a three-element vector, in radians per second.

Programmatic Use

Block Parameter: pm_0
Type: character vector
Values: '[0 0 0]' | three-element vector
Default: '[0 0 0]'

Initial mass of the rigid body, specified as a double scalar.

Programmatic Use

Block Parameter: mass_0
Type: character vector
Values: '1.0' | double scalar
Default: '1.0'

Empty mass of the body, specified as a double scalar.

Programmatic Use

Block Parameter: mass_e
Type: character vector
Values: double scalar
Default: '0.5'

Full mass of the body, specified as a double scalar.

Programmatic Use

Block Parameter: mass_f
Type: character vector
Values: double scalar
Default: '2.0'

Inertia of the body, specified as a double scalar.

Dependencies

To enable this parameter, set Mass type to Fixed.

Programmatic Use

Block Parameter: inertia
Type: character vector
Values: eye(3) | double scalar
Default: eye(3)

Inertia tensor matrix for the empty inertia of the body, specified as 3-by-3 matrix.

Programmatic Use

Block Parameter: inertia_e
Type: character vector
Values: 'eye(3)' | 3-by-3 matrix
Default: 'eye(3)'

Inertia tensor matrix for the full inertia of the body, specified as 3-by-3 matrix.

Programmatic Use

Block Parameter: inertia_f
Type: character vector
Values: '2*eye(3)' | 3-by-3 matrix
Default: '2*eye(3)'

Select this check box to add a mass flow relative velocity port. This is the relative velocity at which the mass is accreted or ablated.

Programmatic Use

Block Parameter: vre_flag
Type: character vector
Values: off | on
Default: off

Select this check box to add an inertial acceleration port.

Dependencies

To enable the Abi port, select this parameter.

Programmatic Use

Block Parameter: abi_flag
Type: character vector
Values: 'off' | 'on'
Default: off

Planet

Planet model to use, Custom or Earth (WGS84).

Programmatic Use

Block Parameter: ptype
Type: character vector
Values: 'Earth (WGS84)' | 'Custom'
Default: 'Earth (WGS84)'

Radius of the planet at its equator, specified as a double scalar, in the same units as the desired units for the ECEF position.

Dependencies

To enable this parameter, set Planet model to Custom.

Programmatic Use

Block Parameter: R
Type: character vector
Values: double scalar
Default: '6378137'

Flattening of the planet, specified as a double scalar.

Dependencies

To enable this parameter, set Planet model to Custom.

Programmatic Use

Block Parameter: F
Type: character vector
Values: double scalar
Default: '1/298.257223563'

Rotational rate of the planet, specified as a scalar, in rad/s.

Dependencies

To enable this parameter, set Planet model to Custom.

Programmatic Use

Block Parameter: w_E
Type: character vector
Values: double scalar
Default: '7292115e-11'

Source of Greenwich meridian initial celestial longitude, specified as:

Internal

Use celestial longitude value from Celestial longitude of Greenwich.

External

Use external input for celestial longitude value.

Dependencies

  • To enable this parameter, set Planet model to Earth.

  • Setting this parameter to External enables the LG(0) port.

  • If Planet model is set to Custom, the parameter name changes to Celestial longitude of prime meridian source.

Programmatic Use

Block Parameter: angle_in
Type: character vector
Values: 'Internal' | 'External'
Default: 'Internal'

Initial angle between Greenwich meridian and the x-axis of the inertial frame, specified as a double scalar.

Dependencies

  • To enable this parameter, set:

    • Celestial longitude of Greenwich source to Internal.

    • Planet model to Earth (WGS84).

  • If Planet model is set to Custom, the parameter name changes to Celestial longitude of prime meridian [deg].

Programmatic Use

Block Parameter: LPM0
Type: character vector
Values: double scalar
Default: '0'

Source of prime meridian initial celestial longitude, specified as:

Internal

Use celestial longitude value from Celestial longitude of prime meridian.

External

Use external input for celestial longitude value.

Dependencies

  • To enable this parameter, set Planet model to Custom.

  • Setting this parameter to External enables the LPM(0) port.

  • If Planet model is set to Earth (WGS84), the parameter name changes to Celestial longitude of Greenwich source.

Programmatic Use

Block Parameter: angle_in
Type: character vector
Values: 'Internal' | 'External'
Default: 'Internal'

Initial angle between prime meridian and the x-axis of the ECI frame, specified as a double scalar.

Dependencies

  • To enable this parameter, set:

    • Celestial longitude of prime meridian source to Internal.

    • Planet model to Custom.

  • If Planet model is set to Earth (WGS84), the parameter name changes to Celestial longitude of Greenwich [deg].

Programmatic Use

Block Parameter: LPM0
Type: character vector
Values: double scalar
Default: '0'

State Attributes

Assign a unique name to each state. You can use state names instead of block paths during linearization.

  • To assign a name to a single state, enter a unique name between quotes, for example, 'velocity'.

  • To assign names to multiple states, enter a comma-separated list surrounded by braces, for example, {'a', 'b', 'c'}. Each name must be unique.

  • If a parameter is empty (' '), no name is assigned.

  • The state names apply only to the selected block with the name parameter.

  • The number of states must divide evenly among the number of state names.

  • You can specify fewer names than states, but you cannot specify more names than states.

    For example, you can specify two names in a system with four states. The first name applies to the first two states and the second name to the last two states.

  • To assign state names with a variable in the MATLAB® workspace, enter the variable without quotes. A variable can be a character vector, cell array, or structure.

Quaternion vector state names, specified as a comma-separated list surrounded by braces.

Programmatic Use

Block Parameter: quat_statename
Type: character vector
Values: '' | comma-separated list surrounded by braces
Default: ''

Body rotation rate state names, specified comma-separated list surrounded by braces.

Programmatic Use

Block Parameter: pm_statename
Type: character vector
Values: '' | comma-separated list surrounded by braces
Default: ''

Velocity state names, specified as comma-separated list surrounded by braces.

Programmatic Use

Block Parameter: Vm_statename
Type: character vector
Values: '' | comma-separated list surrounded by braces
Default: ''

ECEF position state names, specified as a comma-separated list surrounded by braces.

Programmatic Use

Block Parameter: posfixedframe_statename
Type: character vector
Values: '' | comma-separated list surrounded by braces
Default: ''

Inertial position state names, specified as a comma-separated list surrounded by braces.

Default value is ''.

Programmatic Use

Block Parameter: posinertial_statename
Type: character vector
Values: '' | comma-separated list surrounded by braces
Default: ''

Celestial longitude of Greenwich state name, specified as a character vector.

Dependencies

  • To enable this parameter, set:Planet model to Earth (WGS84).

  • If Planet model is set to Custom, the parameter name changes to Celestial longitude of prime meridian: e.g., 'LPM'.

Programmatic Use

Block Parameter: LPM_statename
Type: character vector
Values: '' | scalar
Default: ''

Celestial longitude of prime meridian state name, specified as a character vector.

Dependencies

  • To enable this parameter, set:Planet model to Custom.

  • If Planet model is set to Earth (WGS84), the parameter name changes to Celestial longitude of Greenwich: e.g., 'LG'.

Programmatic Use

Block Parameter: LPM_statename
Type: character vector
Values: '' | scalar
Default: ''

Mass state name, specified as a character vector.

Programmatic Use

Block Parameter: mass_statename
Type: character vector
Values: '' | character vector
Default: ''

Algorithms

The 6DOF ECEF (Quaternion) block uses these equations to describe the translational motion in the fixed (ECEF) coordinate frame.

  • The applied forces Fxyz = [Fx F y Fz]T are given in body-fixed axes.

    Fxyz=[FxFyFz]=mAbi

  • The direction cosine matrices in this block use a subscript convention of two indices indicating target and source axes.

    • The be subscript in DCMbe indicates a rotation from NED axes e to body axes b.

    • The bf subscript in DCMbf indicates a rotation from fixed-frame axes f to body axes b.

  • The inertial acceleration of the body Abi is the input force divided by the mass, calculated with:

    Abi=Fxyzm

  • The acceleration of the body in the body-fixed frame of reference Abb accounts for

    • Coriolis and centrifugal accelerations

    • Derivative of the body-fixed coordinate system relative to the fixed-frame coordinate system

    Abb is defined as:

    Abb=[u˙v˙w˙]=Fxyzm(ωbi+DCMbfωei)×VffDCMbf(ωei×(ωei×Xff))

    where

    EquationDescription

    Vff=[uvw]

    Body velocity relative to the fixed-frame, expressed in body axes.

    ωbe

    Body rotation rate relative to NED frame, in body axes.

    ωbi=ωbe+DCMbfωei+DCMbeωNED

    Body rotation rate relative to intertial frame.

    ωei

    Earth rotation rate.

    Xff

    Fixed-frame position of body relative to origin.

  • The rotation rate of the body relative to the fixed-frame contains:

    • Earth rotation rate

    • Body frame rotation rate

    • Relative angular rates with respect to the north-east-down (NED) frame, defined as:

      ωNED=[l˙cosμμ˙l˙sinμ]=[VE(N+h)VN(M+h)VEtanμ(N+h)]

  • The rotational dynamics of the body defined in body-fixed frame are given, where the applied moments are [L M N]T, and the inertia tensor I is with respect to the origin O.

    Abb=[u˙bv˙bω˙b]=1mF¯b[ω¯b×V¯b+DCMbfω¯e×V¯b+DCMbf(ω¯e×(ω¯e×X¯f))]Abecef=FbmM¯b=[LMN]=Iω¯˙b+ω¯b×(Iω¯b)I=[IxxIxyIxzIyxIyyIyzIzxIzyIzz]

    The integration of the rate of change of the quaternion vector is given:

    [q˙0q˙1q˙2q˙3]=12[0ωb(1)ωb(2)ωb(3)ωb(1)0ωb(3)ωb(2)ωb(2)ωb(3)0ωb(1)ωb(3)ωb(2)ωb(1)0][q0q1q2q3]

    Aerospace Blockset uses quaternions that are defined using the scalar-first convention.

References

[1] Stevens, Brian, and Frank Lewis. Aircraft Control and Simulation, 2nd ed. Hoboken, NJ: John Wiley & Sons, 2003.

[2] McFarland, Richard E. "A Standard Kinematic Model for Flight simulation at NASA-Ames" NASA CR-2497.

[3] "Supplement to Department of Defense World Geodetic System 1984 Technical Report: Part I - Methods, Techniques and Data Used in WGS84 Development." DMA TR8350.2-A.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2006a

expand all