# Simple Variable Mass 3DOF (Body Axes)

Implement three-degrees-of-freedom equations of motion of simple variable mass with respect to body axes

**Libraries:**

Aerospace Blockset /
Equations of Motion /
3DOF

## Description

The Simple Variable Mass 3DOF (Body Axes) block implements three-degrees-of-freedom equations of motion of simple variable mass with respect to body axes. It considers the rotation in the vertical plane of a body-fixed coordinate frame about a flat Earth reference frame. For more information about the rotation and equations of motion, see Algorithms.

## Ports

### Input

**F**_{x} — Applied force along *x*-axis

scalar

_{x}

Applied force along the body *x*-axis, specified as a scalar, in the
units selected in **Units**.

**Data Types: **`double`

**F**_{z} — Applied force along *z*-axis

scalar

_{z}

Applied force along the body *z*-axis, specified as a scalar.

**Data Types: **`double`

**M** — Applied pitching moment

scalar

Applied pitching moment, specified as a scalar.

**Data Types: **`double`

**dm/dt** — Rate of change of mass

scalar

Rate of change of mass (positive if accreted, negative if ablated), specified as a scalar.

#### Dependencies

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

**Data Types: **`double`

**g** — Gravity

scalar

Gravity, specified as a scalar.

#### Dependencies

To enable this port, set **Gravity source** to
`External`

.

**Data Types: **`double`

**V**_{re} — Relative velocity

two-element vector

_{re}

Relative velocity at which mass is accreted to or ablated from the body in body-fixed axes, specified as a two-element vector.

#### Dependencies

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

**Data Types: **`double`

### Output

**θ** — Pitch altitude

scalar

Pitch attitude, within ±pi, returned as a scalar, in radians.

**Data Types: **`double`

**q** — Pitch angular rate

scalar

Pitch angular rate, returned as a scalar, in radians per second.

**Data Types: **`double`

**dq/dt** — Pitch angular acceleration

scalar

Pitch angular acceleration, returned as a scalar, in radians per second squared.

**Data Types: **`double`

**X**_{e}Z_{e} — Location of body

two-element vector

_{e}Z

_{e}

Location of the body in the flat Earth reference frame, (*Xe, Ze*), returned
as a two-element vector.

**Data Types: **`double`

**U w** — Velocity of body

two-element vector

Velocity of the body resolved into the body-fixed coordinate frame, (*u, w*),
returned as a two-element vector.

**Data Types: **`double`

**A**_{xb}A_{zb} — Acceleration of body

two-element vector

_{xb}A

_{zb}

Acceleration of the body with respect to the body-fixed coordinate frame, (*Ax,
Az*), returned as a two-element
vector.

**Data Types: **`double`

**Fuel** — Fuel tank status

scalar

Fuel tank status, returned as:

`1`

— Tank is full.`0`

— Tank is neither full nor empty.`-1`

— Tank is empty.

#### Dependencies

To enable this port, set **Mass type** to `Simple Variable`

.

**Data Types: **`double`

**A**_{xe}A_{ze} — Acceleration of body

two-element vector

_{xe}A

_{ze}

Accelerations of the body with respect to the inertial (flat Earth) coordinate frame, returned as a two-element vector. You typically connect this signal to the accelerometer.

#### Dependencies

To enable this port, select the **Include inertial
acceleration** check box.

**Data Types: **`double`

## Parameters

### Main

**Units** — Input and output units

`Metric (MKS)`

(default) | `English (Velocity in ft/s)`

| `English (Velocity in kts)`

Input and output units, specified as `Metric (MKS)`

, `English (Velocity in ft/s)`

, or `English (Velocity in kts)`

.

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 |

#### Programmatic Use

Block Parameter:
`units` |

Type: character vector |

Values: `Metric (MKS)` | `English (Velocity in ft/s)` | `English (Velocity in kts)` |

Default: `Metric (MKS)` |

**Axes** — Body or wind axes

`Body`

(default) | `Wind`

Body or wind axes, specified as `Wind`

or
`Body`

.

#### Programmatic Use

Block Parameter:
`axes` |

Type: character
vector |

Values:
`Wind` | `Body` |

Default:
`Body` |

**Mass type** — Mass type

`Simple Variable`

(default) | `Fixed`

| `Custom Variable`

Mass type, specified according to the following table.

Mass Type | Description | Default For |
---|---|---|

`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 `Simple Variable`

selection conforms to the
equations of motion described in Algorithms.

#### Programmatic Use

Block Parameter:
`mtype` |

Type: character
vector |

Values:
`Fixed` | `Simple Variable` |
`Custom Variable` |

Default:
`'Simple Variable'` |

**Initial velocity** — Initial velocity of body

`100`

(default) | scalar

Initial velocity of the body,
(*V*_{0}),
specified as a scalar.

#### Programmatic Use

Block
Parameter:
`v_ini` |

Type:
character vector |

Values:
`'100'` | scalar |

Default:
`'100'` |

**Initial body attitude** — Initial pitch altitude

`0`

(default) | scalar

Initial pitch attitude of the body, (*θ*_{0}), specified as a scalar.

#### Programmatic Use

Block Parameter: `theta_ini` |

Type: character vector |

Values:
`'0'` | scalar |

Default: `'0'` |

**Initial body rotation rate** — Initial pitch rotation rate

`0`

(default) | scalar

Initial pitch rotation rate,
(*q*_{0}),
specified as a scalar.

#### Programmatic Use

Block
Parameter:
`q_ini` |

Type:
character vector |

Values:
`'0'` | scalar |

Default:
`'0'` |

**Initial incidence** — Initial angle

`0`

(default) | scalar

Initial angle between the velocity vector and the body, (*α*_{0}), specified as a scalar.

#### Programmatic Use

Block Parameter: `alpha_ini` |

Type: character vector |

Values:
`'0'` | scalar |

Default: `'0'` |

**Initial position (x,z)** — Initial location

`[0 0]`

(default) | two-element vector

Initial location of the body in the flat Earth reference frame, specified as a two-element vector.

#### Programmatic Use

Block Parameter:
`pos_ini` |

Type: character vector |

Values:
`'[0 0]'` | two-element vector |

Default:
`'[0 0]'` |

**Initial mass** — Initial mass

`1.0`

(default) | scalar

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

#### Programmatic Use

Block Parameter: `mass` |

Type: character vector |

Values:
`'1.0'` | scalar |

Default:
`'1.0'` |

**Empty mass** — Mass of body when fuel tank is empty

`0.5`

(default) | scalar

Mass of body when fuel tank is empty, specified as a scalar.

#### Programmatic Use

Block Parameter:
`mass_e` |

Type: character vector |

Values:
`'0.5'` | scalar |

Default:
`'0.5'` |

**Full mass** — Mass of body when fuel tank is full

`3.0`

(default) | scalar

Mass of body when fuel tank is full, specified as a scalar.

#### Programmatic Use

Block Parameter:
`mass_f` |

Type: character vector |

Values:
`'3.0'` | scalar |

Default:
`'3.0'` |

**Empty inertia** — Body inertia when fuel tank is full

`0.5`

(default) | scalar

Body inertia when the fuel tank is full, specified as a double scalar.

#### Programmatic Use

Block Parameter:
`Iyy_e` |

Type: character vector |

Values:
`'0.5'` | scalar |

Default:
`'0.5'` |

**Full inertia** — Full inertia

`3.0`

(default) | scalar

Full inertia of the body, specified as a scalar.

#### Programmatic Use

Block Parameter: `Iyy_f` |

Type: character vector |

Values:
`'3.0'` | scalar |

Default: `'3.0'` |

**Gravity Source** — Gravity source

`Internal`

(default) | `External`

Gravity source, specified as:

`External` | Variable gravity input to block |

`Internal` | Constant gravity specified in mask |

#### Programmatic Use

Block Parameter: `g_in` |

Type: character vector |

Values: `'Internal'` | `'External'` |

Default: `'Internal'` |

**Acceleration due to gravity** — Gravity source

`9.81`

(default) | scalar

Acceleration due to gravity, specified as a double scalar and used if internal gravity source
is selected. If gravity is to be neglected in the simulation, this value can be set to
`0`

.

#### Dependencies

To enable this parameter, set

**Gravity Source**to`Internal`

.

#### Programmatic Use

Block Parameter: `g` |

Type: character vector |

Values:
`'9.81'` | scalar |

Default: `'9.81'` |

**Include mass flow relative velocity** — Mass flow relative velocity port

`off`

(default) | `on`

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'` |

**Limit mass flow when mass is empty or full** — Limit mass flow

`on`

(default) | `off`

Select this check box to limit the input mass flow rate when one of these is true:

Fuel tank is full and input mass flow rate is positive.

Fuel tank is empty and input mass flow rate is negative.

When the input mass flow rate might cause the mass to exceed its limits, the block uses a zero mass flow rate value in the equations of motion. For more information, see Algorithms.

If you do not want to limit the input mass flow rate, clear this check box.

#### Dependencies

To enable this parameter, set **Mass type** to
`Simple Variable`

.

#### Programmatic Use

Block Parameter:
`mdot_flag` |

Type: character
vector |

Values:
`'off'` | `'on'` |

Default:
`'on'` |

**Data Types: **`double`

**Include inertial acceleration** — Include inertial acceleration port

`off`

(default) | `on`

Select this check box to add an inertial acceleration in flat Earth frame output port. You typically connect this signal to the accelerometer.

#### Dependencies

To enable the **A _{xe}A_{ze}** port, select this parameter.

#### Programmatic Use

Block Parameter: `abi_flag` |

Type: character vector |

Values:
`'off'` |
`'on'` |

Default:
`'off'` |

### State Attributes

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

The number of names must match the number of states, as shown for each item, or be empty. Set all or none of the block states.

To assign names to single-variable states, enter unique names between quotes, for example,

`'q'`

or`"q"`

.To assign names to two-variable states, enter a comma-separated list surrounded by braces, for example,

`{'Xe','Ze'}`

.If a state parameter is empty (

`' '`

), no name is assigned.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 of character vectors, or string.

**Velocity: e.g., {'u, 'w'}** — Velocity state name

`''`

(default) | comma-separated list surrounded by braces

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

#### Programmatic Use

Block Parameter: `vel_statename` |

Type: character vector |

Values:
`''` | comma-separated list surrounded by braces |

Default: `''` |

**Pitch attitude: e.g., 'theta'** — Pitch attitude state name

`''`

(default)

Pitch attitude state name, specified as a character vector or string.

#### Programmatic Use

Block Parameter:
`theta_statename` |

Type: character vector | string |

Values:
`''` |

Default:
`''` |

**Position: e.g., {'Xe', 'Ze'}** — Position state name

`''`

(default) | comma-separated list surrounded by braces

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

#### Programmatic Use

Block Parameter: `pos_statename` |

Type: character vector |

Values:
`''` | comma-separated list surrounded by braces |

Default: `''` |

**Pitch angular rate e.g., 'q'** — Pitch angular rate state name

`''`

(default)

Pitch angular rate state name, specified as a character vector or string.

#### Programmatic Use

Block Parameter:
`q_statename` |

Type: character vector | string |

Values:
`''` | scalar |

Default:
`''` |

**Mass: e.g., 'mass'** — Mass state name

`''`

(default) | scalar

Mass state name, specified as a character vector or string.

#### Programmatic Use

Block Parameter: `mass_statename` |

Type: character vector | string |

Values: `''` | scalar |

Default: `''` |

## Algorithms

It considers the rotation in the vertical plane of a body-fixed coordinate frame about a flat Earth reference frame.

The equations of motion are

$$\begin{array}{l}{A}_{xb}=\dot{u}={A}_{xe}-qw\\ {A}_{zb}=\dot{w}={A}_{ze}+qu\\ {A}_{xe}=\frac{\left({F}_{x}-\dot{m}{u}_{re}\right)}{m}-g\mathrm{sin}\theta \\ {A}_{ze}=\frac{\left({F}_{z}-\dot{m}{w}_{re}\right)}{m}+g\mathrm{cos}\theta \\ {\dot{X}}_{e}=u\mathrm{cos}\theta +w\mathrm{sin}\theta \\ {\dot{Z}}_{e}=-u\mathrm{sin}\theta +w\mathrm{cos}\theta \\ \dot{q}=\frac{{M}_{y}-{\dot{I}}_{yy}q}{{I}_{yy}}\\ \dot{\theta}=q\\ {\dot{I}}_{yy}=\frac{{I}_{yy\_full}-{I}_{yy\_empty}}{{m}_{full}-{m}_{empty}}\dot{m}\\ {I}_{yy}={I}_{yy\_empty}+\left({I}_{yy\_full-}{I}_{yy\_empty}\right)\frac{m-{m}_{empty}}{{m}_{full}-{m}_{empty}}\end{array}$$

where the applied forces are assumed to act at the center of gravity of the body. Input
variables are *F _{x}*,

*F*,

_{z}*M*, $$\dot{m}$$.

_{y}*u*,

_{re}*w*, and

_{re}*g*are optional input variables. Mass

*m*is limited to between

*m*and

_{empty}*m*. Whenever mass is saturated at empty or full, for consistency, limit $$\dot{m}$$ within the equations of motion.

_{full}## Extended Capabilities

### C/C++ Code Generation

Generate C and C++ code using Simulink® Coder™.

## Version History

**Introduced in R2006a**

### Simple Variable Mass 3DOF (Body Axes) Block Changes

The 3DOF equations of motion have been updated. Existing models created prior to R2021b that contain 3DOF equations of motion blocks continue to run. If you replace a pre-R2021b version of a 3DOF equation of motion block with an R2021b or later version, your updated model might have a higher tendency for algebraic loops. For an example of how to remove algebraic loops using unit delays, see Remove Algebraic Loops. For further information about algebraic loops, see Identify Algebraic Loops in Your Model.

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)