Main Content

6DOF ECEF (Quaternion)

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

  • Library:
  • Aerospace Blockset / Equations of Motion / 6DOF

  • 6DOF ECEF (Quaternion) block

Description

The 6DOF ECEF (Quaternion) block Implement quaternion representation of six-degrees-of-freedom equations of motion in Earth-centered Earth-fixed (ECEF) coordinates. It considers the rotation of a 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.

Limitations

  • This implementation assumes that the applied forces act at the center of gravity of the body, and that the mass and inertia are constant.

  • 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-handed 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-handed system.

Ports

Input

expand all

Applied forces, specified as a three-element vector.

Data Types: double

Applied moments, specified as a three-element vector.

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.

Data Types: double

Output

expand all

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

Data Types: double

Position in ECEF reference frame, returned as a three-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

Body rotation angles [roll, pitch, yaw], returned as a three-element vector, in radians. Euler rotation angles are those between body and NED coordinate systems.

Data Types: double

Coordinate transformation from ECI axes to body-fixed axes, returned as a 3-by-3 matrix.

Data Types: double

Coordinate transformation from NED axes to body-fixed axes, returned as a 3-by-3 matrix.

Data Types: double

Coordinate transformation from ECEF axes to NED axes, returned as a 3-by-3 matrix.

Data Types: double

Velocity of body with respect to ECEF frame, 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 ECI 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 ECI frame, expressed in body frame and returned as a three-element vector, in radians per second squared.

Data Types: double

Accelerations of the body with respect to the ECEF coordinate frame, returned as a three-element vector.

Data Types: double

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

Dependencies

To enable this point, 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)

Select the type of mass to use:

The Fixed 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 aircraft 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 in body axes, specified as a three-element vector, in the body-fixed coordinate frame.

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. Euler rotation angles are those between the body and north-east-down (NED) coordinate systems.

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'

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)

Select this check box to add an inertial acceleration port.

Dependencies

To enable the Abe 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

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

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 ECI frame, specified as a double scalar.

Dependencies

To enable this parameter, set Celestial longitude of Greenwich source to Internal.

Programmatic Use

Block Parameter: LG0
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: posECEF_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: posECI_statename
Type: character vector
Values: '' | comma-separated list surrounded by braces
Default: ''

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

Programmatic Use

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

Algorithms

The origin of the ECEF coordinate frame is the center of the Earth. In addition, the body of interest is assumed to be rigid, an assumption that eliminates the need to consider the forces acting between individual elements of mass. The representation of the rotation of ECEF frame from ECI frame is simplified to consider only the constant rotation of the ellipsoid Earth (ωe) including an initial celestial longitude (LG(0)). This excellent approximation allows the forces due to the Earth's complex motion relative to the “fixed stars” to be neglected.

The translational motion of the ECEF coordinate frame is given below, where the applied forces [Fx Fy Fz]T are in the body frame and the mass of the body m is assumed constant.

F¯b=[FxFyFz]=m(V¯˙b+ω¯b×V¯b+DCMbfω¯e×V¯b+DCMbf(ω¯e×(ω¯e×X¯f)))

where the change of position in ECEF x¯˙f is calculated by

x¯˙f=DCMfbV¯b

and the velocity of the body with respect to ECEF frame, expressed in body frame (V¯b), angular rates of the body with respect to ECI frame, expressed in body frame (ω¯b). Earth rotation rate (ω¯e), and relative angular rates of the body with respect to north-east-down (NED) frame, expressed in body frame (ω¯rel), are defined as

V¯b=[uvw],ω¯rel=[pqr],ω¯e=[00ωe],ω¯b=ω¯rel+DCMbfω¯e+DCMbeω¯nedω¯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 below, 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 below.

[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

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

Introduced in R2006a