Documentation

# 6DOF ECEF (Quaternion)

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

## Library

Equations of Motion/6DOF ## Description

The 6DOF ECEF (Quaternion) block 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, additionally 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.

${\overline{F}}_{b}=\left[\begin{array}{c}{F}_{x}\\ {F}_{y}\\ {F}_{z}\end{array}\right]=m\left({\stackrel{˙}{\overline{V}}}_{b}+{\overline{\omega }}_{b}×{\overline{V}}_{b}+DC{M}_{bf}{\overline{\omega }}_{e}×{\overline{V}}_{b}+DC{M}_{bf}\left({\overline{\omega }}_{e}×\left({\overline{\omega }}_{e}×{\overline{X}}_{f}\right)\right)\right)$

where the change of position in ECEF ${\stackrel{˙}{\overline{x}}}_{f}$ is calculated by

`${\stackrel{˙}{\overline{x}}}_{f}=DC{M}_{fb}{\overline{V}}_{b}$`

and the velocity of the body with respect to ECEF frame, expressed in body frame $\left({\overline{V}}_{b}\right)$, angular rates of the body with respect to ECI frame, expressed in body frame $\left({\overline{\omega }}_{b}\right)$. Earth rotation rate $\left({\overline{\omega }}_{e}\right)$, and relative angular rates of the body with respect to north-east-down (NED) frame, expressed in body frame $\left({\overline{\omega }}_{rel}\right)$ are defined as

`$\begin{array}{l}{\overline{V}}_{b}=\left[\begin{array}{c}u\\ v\\ w\end{array}\right],{\overline{\omega }}_{rel}=\left[\begin{array}{c}p\\ q\\ r\end{array}\right],{\overline{\omega }}_{e}=\left[\begin{array}{c}0\\ 0\\ {\omega }_{e}\end{array}\right],{\overline{\omega }}_{b}={\overline{\omega }}_{rel}+DC{M}_{bf}{\overline{\omega }}_{e}+DC{M}_{be}{\overline{\omega }}_{ned}\\ {\overline{\omega }}_{ned}=\left[\begin{array}{c}\stackrel{˙}{l}\mathrm{cos}\mu \\ -\stackrel{˙}{\mu }\\ -\stackrel{˙}{l}\mathrm{sin}\mu \end{array}\right]=\left[\begin{array}{c}{V}_{E}/\left(N+h\right)\\ -{V}_{N}/\left(M+h\right)\\ -{V}_{E}•\mathrm{tan}\mu /\left(N+h\right)\end{array}\right]\end{array}$`

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.

`$\begin{array}{l}{A}_{bb}=\left[\begin{array}{c}{\stackrel{˙}{u}}_{b}\\ {\stackrel{˙}{v}}_{b}\\ {\stackrel{˙}{\omega }}_{b}\end{array}\right]=\frac{1}{m}{\overline{F}}_{b}-\left[{\overline{\omega }}_{b}×{\overline{V}}_{b}+DC{M}_{bf}{\overline{\omega }}_{e}×{\overline{V}}_{b}+DC{M}_{bf}\left({\overline{\omega }}_{e}×\left({\overline{\omega }}_{e}×{\overline{X}}_{f}\right)\right)\right]\\ {A}_{b}{\text{​}}_{ecef}=\frac{{F}_{b}}{m}\\ {\overline{M}}_{b}=\left[\begin{array}{c}L\\ M\\ N\end{array}\right]=I{\stackrel{˙}{\overline{\omega }}}_{b}+{\overline{\omega }}_{b}×\left(I{\overline{\omega }}_{b}\right)\\ I=\left[\begin{array}{ccc}{I}_{xx}& -{I}_{xy}& -{I}_{xz}\\ -{I}_{yx}& {I}_{yy}& -{I}_{yz}\\ -{I}_{zx}& -{I}_{zy}& {I}_{zz}\end{array}\right]\end{array}$`

The integration of the rate of change of the quaternion vector is given below.

`$\left[\begin{array}{c}{\stackrel{˙}{q}}_{0}\\ {\stackrel{˙}{q}}_{1}\\ {\stackrel{˙}{q}}_{2}\\ {\stackrel{˙}{q}}_{3}\end{array}\right]=-1}{2}\left[\begin{array}{cccc}0& {\omega }_{b}\left(1\right)& {\omega }_{b}\left(2\right)& {\omega }_{b}\left(3\right)\\ -{\omega }_{b}\left(1\right)& 0& -{\omega }_{b}\left(3\right)& {\omega }_{b}\left(2\right)\\ -{\omega }_{b}\left(2\right)& {\omega }_{b}\left(3\right)& 0& -{\omega }_{b}\left(1\right)\\ -{\omega }_{b}\left(3\right)& -{\omega }_{b}\left(2\right)& {\omega }_{b}\left(1\right)& 0\end{array}\right]\left[\begin{array}{c}{q}_{0}\\ {q}_{1}\\ {q}_{2}\\ {q}_{3}\end{array}\right]$`

## Parameters

### Main

Units

Specifies the input and output units:

Units

Forces

Moment

Acceleration

Velocity

Position

Mass

Inertia

`Metric (MKS)`

Newton

Newton meter

Meters per second squared

Meters per second

Meters

Kilogram

Kilogram meter squared

`English (Velocity in ft/s)`

Pound

Foot pound

Feet per second squared

Feet per second

Feet

Slug

Slug foot squared

`English (Velocity in kts)`

Pound

Foot pound

Feet per second squared

Knots

Feet

Slug

Slug foot squared

Mass type

Select the type of mass to use:

 `Fixed` Mass is constant throughout the simulation. `Simple Variable` Mass and inertia vary linearly as a function of mass rate. `Custom Variable` Mass and inertia variations are customizable.

The `Fixed` selection conforms to the previously described equations of motion.

Initial position in geodetic latitude, longitude and altitude

The three-element vector for the initial location of the body in the geodetic reference frame, with latitude, longitude, and altitude. The altitude value depends on the selected units (meters (MKS) or feet (English)). Latitude and longitude values are in degrees and can be any value. However, latitude values of +90 and -90 may return unexpected values because of singularity at the poles.

Initial velocity in body axes

The three-element vector containing the initial velocity of the body with respect to ECEF frame, expressed in body frame.

Initial Euler orientation

The three-element vector containing the initial Euler rotation angles [roll, pitch, yaw], in radians. Euler rotation angles are those between the body and north-east-down (NED) coordinate systems.

Initial body rotation rates

The three-element vector for the initial angular rates of the body with respect to NED frame, expressed in body frame, in radians per second.

Initial mass

The mass of the rigid body.

Inertia

The 3-by-3 inertia tensor matrix I, in body-fixed axes.

Planet model

Specifies the planet model to use: `Custom` or ```Earth (WGS84)```.

Flattening

Specifies the flattening of the planet. This option is only available when Planet model is set to `Custom`.

Specifies the radius of the planet at its equator. The units of the equatorial radius parameter should be the same as the units for ECEF position. This option is only available when Planet model is set to `Custom`.

Rotational rate

Specifies the scalar rotational rate of the planet in rad/s. This option is only available when Planet model is set to `Custom`.

Celestial longitude of Greenwich source

Specifies the source of Greenwich meridian's initial celestial longitude:

 `Internal` Use celestial longitude value from mask dialog. `External` Use external input for celestial longitude value.
Celestial longitude of Greenwich

The initial angle between Greenwich meridian and the x-axis of the ECI frame.

Include inertial acceleration

Select this check box to enable an additional output port for the accelerations in body-fixed axes with respect to the inertial frame. You typically connect this signal to the accelerometer.

### State Attributes

Assign 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-delimited list surrounded by braces, for example, `{'a', 'b', 'c'}`. Each name must be unique.

• If a parameter is empty (`' '`), no name assignment occurs.

• 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: e.g., {'qr', 'qi', 'qj', 'qk'}

Specify quaternion vector state names.

Default value is `''`.

Body rotation rates: e.g., {'p', 'q', 'r'}

Specify body rotation rate state names.

Default value is `''`.

Velocity: e.g., {'U', 'v', 'w'}

Specify velocity state names.

Default value is `''`.

ECEF position: e.g., {'Xecef', 'Yecef', 'Zecef'}

Specify the ECEF position state names.

Default value is `''`.

Inertial position: e.g., {'Xeci', 'Yeci', 'Zeci'}

Specify the inertial position state names.

Default value is `''`.

Celestial longitude of Greenwich: e.g., 'LG'

Specify the Celestial longitude of Greenwich state name.

Default value is `''`.

## Inputs and Outputs

InputDimension TypeDescription
FirstVectorContains the three applied forces in body-fixed axes.
SecondVectorContains the three applied moments in body-fixed axes.
OutputDimension TypeDescription
FirstVectorContains the velocity of the body with respect to ECEF frame, expressed in ECEF frame.
SecondThree-element vectorContains the position in ECEF reference frame.
ThirdThree-element vectorContains the position in geodetic latitude, longitude and altitude, in degrees, degrees and selected units of length respectively.
FourthThree-element vectorContains the body rotation angles [roll, pitch, yaw], in radians. Euler rotation angles are those between the body and north-east-down (NED) coordinate systems.
Fifth3-by-3 matrixApplies to the coordinate transformation from ECI axes to body-fixed axes
Sixth3-by-3 matrixApplies to the coordinate transformation from NED axes to body-fixed axes.
Seventh3-by-3 matrix Applies to the coordinate transformation from ECEF axes to NED axes.
EighthThree-element vectorContains the velocity of the body with respect to ECEF frame, expressed in the body frame.
Ninth Three-element vector Contains the relative angular rates of the body with respect to NED frame, expressed in the body frame, in radians per second.
TenthThree-element vectorContains the angular rates of the body with respect to the ECI frame, expressed in body frame, in radians per second.
EleventhThree-element vectorContains the angular accelerations of the body with respect to ECI frame, expressed in the body frame, in radians per second squared.
TwelfthThree-element vectorContains the accelerations in body-fixed axes with respect to body frame.
Thirteenth (Optional)Three-element vectorContains the accelerations in body-fixed axes with respect to ECEF frame.

## Assumptions and Limitations

This implementation assumes that the applied forces are acting 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.

## References

Stevens, B. L., and F. L. Lewis, Aircraft Control and Simulation, Second Edition, John Wiley & Sons, New York, 2003.

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

“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.

#### Introduced in R2006a

##### Support Get trial now