Skip to content

ELV Launch Vehicle — Longitudinal Dynamics

ELV (Expendable Launch Vehicle) is a carrier rocket for orbital payload delivery. Its longitudinal flight channel is implemented as a linear state-space model and a compatible Gymnasium environment.

Expendable launch vehicle

  • Quick start

    Launch the environment or the model within minutes.

    See example

  • Model API

    Python class documentation for the ELV model.

    Go to API

  • Gymnasium environment

    Ready environment for RL agents.

    Explore

  • Theory

    State equations and numerical parameters.

    Learn more

Control object structure

The model is defined in the state space:

\[\dot{x} = A x + B u, \quad y = C x + D u\]

where:

\[ x = \begin{bmatrix} w & q & \theta \end{bmatrix}^{\top}, \quad u_{in} = \eta \]

The typical matrix structure is:

\[ \begin{bmatrix} \dot{w} \\ \dot{q} \\ \dot{\theta} \end{bmatrix} = \begin{bmatrix} z_w & z_q & z_{\theta} \\ m_w & m_q & m_{\theta} \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} w \\ q \\ \theta \end{bmatrix} + \begin{bmatrix} z_{\eta} \\ m_{\eta} \\ 0 \end{bmatrix} \eta \]
  • w: normal speed, m/s
  • q: pitch rate, rad/s
  • θ: pitch angle, rad
  • η: control input (pitch actuator), rad
  • z_w, z_q, z_θ — partial derivatives of normal force \(Z\) with respect to \(w, q, \theta\)
  • m_w, m_q, m_θ — partial derivatives of pitch moment \(M\) with respect to \(w, q, \theta\)
  • z_η, m_η — partial derivatives with respect to the control input \(\eta\)

Units

Angles and angular rates are in radians. API methods can return values in degrees.

Mathematical model

\[ \dot{x} = A x + B u, \qquad y = C x + D u \]

Numerical matrices (example linearization):

\[ \begin{bmatrix} \dot{w} \\ \dot{q} \\ \dot{\theta} \end{bmatrix} = \begin{bmatrix} -100.858 & 1 & -0.1256 \\ 14.7805 & 0 & 0.01958 \\ 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} w \\ q \\ \theta \end{bmatrix} + \begin{bmatrix} 0 \\ 3.4558 \\ 20.42 \end{bmatrix} \eta \]

Derivatives (numerical values)

  • Matrix A (derivatives):
Coefficient Value
z_w -100.858
z_q 1.0
z_θ -0.1256
m_w 14.7805
m_q 0.0
m_θ 0.01958
  • Input η (column B):
Coefficient Value
z_η 0.0
m_η 3.4558

Actuator limits

Default control limits:

  • Maximum magnitude: \(\pm 25^\circ\)
  • Maximum rate: \(60^\circ/\text{s\)

Internal computations operate in radians; limits are converted accordingly.

Sources

  1. Aliyu, Bhar & Funmilayo, A. & Okwo, Odooh & Sholiyi, Olusegun. (2019). State‑Space Modelling of a Rocket for Optimal Control System Design. Journal of Aircraft and Spacecraft Technology. 3. 128‑137. 10.3844/jastsp.2019.128.137. Link
  2. Aliyu, Bhar. (2011). Expendable Launch Vehicle Flight Control — Design & Simulation with Matlab/Simulink. Link

Reward

The default reward function returns the negative absolute tracking error for the pitch angle:

\[r_t = -|\theta(t) - \theta_{\text{ref}}(t)|\]

Higher reward (closer to 0) indicates better tracking performance. A custom reward function can be passed via the reward_func parameter.

Quick start

import gymnasium as gym
import numpy as np

from tensoraerospace.envs import LinearLongitudinalELVRocket
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import unit_step

dt = 0.01
tp = generate_time_period(tn=20, dt=dt)
number_time_steps = len(tp)
reference_signals = unit_step(degree=5, tp=tp, time_step=10, output_rad=True).reshape(1, -1)

env = gym.make(
    'LinearLongitudinalELVRocket-v0',
    number_time_steps=number_time_steps,
    initial_state=[[0],[0],[0]],
    reference_signal=reference_signals,
)

state, info = env.reset()
for _ in range(200):
    action = np.array([[0.1]])
    state, reward, terminated, truncated, info = env.step(action)
    if terminated or truncated:
        break
import numpy as np
from tensoraerospace.aerospacemodel import ELVRocket

dt = 0.01
number_time_steps = 200

x0 = np.array([0.0, 0.0, 0.0])  # [w, q, theta]

model = ELVRocket(
    x0=x0,
    number_time_steps=number_time_steps,
    selected_state_output=["w", "q", "theta"],
    dt=dt,
)

for t in range(number_time_steps - 1):
    u = np.array([[0.05]])  # control (rad)
    x_next = model.run_step(u)

Python API

ELVRocket(x0, number_time_steps, selected_state_output=None, t0=0, dt=0.01)

Bases: ModelBase

ELV rocket in longitudinal control channel.

Parameters:

Name Type Description Default
x0 ndarray | list[float]

Initial state of the control object.

required
number_time_steps int

Number of time steps.

required
selected_state_output optional

Selected states of the control object. Defaults to None.

None
t0 int

Initial time. Defaults to 0.

0
dt float

Discretization frequency. Defaults to 0.01.

0.01
Action space

ele: elevator [rad]

State space (order): alpha: Angle of attack [rad] q: Pitch angular velocity [rad/s] theta: Pitch [rad]

Output space (order): alpha: Angle of attack [rad] q: Pitch angular velocity [rad/s] theta: Pitch [rad]

Note

The stored A/B matrices are linearised about a trim point and the first state is the angle of attack alpha (in radians), not the body-frame normal velocity w (in m/s). The coefficient A[0, 0]= -100.858 is a typical Z_alpha-type stability derivative; the corresponding coefficient for w in SI units would be several orders of magnitude smaller. Labels were kept consistent with that physical meaning.

import_linear_system()

Load (set) stored linearised system matrices.

The matrices are defined for the state vector x = [alpha, q, theta] (angle of attack in radians, pitch rate in rad/s, pitch angle in radians) and the control u = [ele] (elevator deflection in radians). The coefficients are classical stability derivatives for a rocket's longitudinal short-period mode, so the first state has units of radians of angle of attack, not m/s of body-frame normal velocity.

initialise_system(x0, number_time_steps)

Initialize the system and allocate history buffers.

Parameters:

Name Type Description Default
x0 ndarray | list[float]

Initial state.

required
number_time_steps int

Number of simulation steps.

required

run_step(ut_0)

Run one discrete-time simulation step.

Parameters:

Name Type Description Default
ut_0 ndarray

Control vector.

required

Returns:

Type Description
ndarray

np.ndarray: Next state at time t+1.

update_system_attributes()

Update time-dependent attributes after each simulation step.

get_state(state_name, to_deg=False, to_rad=False)

Return the time history of a state.

Parameters:

Name Type Description Default
state_name str

State name.

required
to_deg bool

Convert radians to degrees.

False
to_rad bool

Convert degrees to radians.

False

Returns:

Type Description
ndarray

np.ndarray: State history array.

get_control(control_name, to_deg=False, to_rad=False)

Return the time history of a control input.

Parameters:

Name Type Description Default
control_name str

Control signal name.

required
to_deg bool

Convert radians to degrees.

False
to_rad bool

Convert degrees to radians.

False

Returns:

Type Description
ndarray

np.ndarray: Control history array.

get_output(state_name, to_deg=False, to_rad=False)

Return the time history of an output signal.

Parameters:

Name Type Description Default
state_name str

Output name.

required
to_deg bool

Convert radians to degrees.

False
to_rad bool

Convert degrees to radians.

False

Returns:

Type Description
ndarray

np.ndarray: Output history array.

plot_output(output_name, time, lang='rus', to_deg=False, to_rad=False, figsize=(10, 10))

Plot an output signal over time.

Parameters:

Name Type Description Default
output_name str

Output name.

required
time ndarray

Time vector.

required
lang str

Axis label language ('rus' or 'eng'). Defaults to 'rus'.

'rus'
to_deg bool

Convert radians to degrees.

False
to_rad bool

Convert degrees to radians.

False
figsize tuple

Figure size.

(10, 10)

Returns:

Type Description
Figure

matplotlib.figure.Figure: Figure object.

LinearLongitudinalELVRocket(initial_state, reference_signal, number_time_steps, tracking_states=None, state_space=None, control_space=None, output_space=None, reward_func=None, dt=0.01)

Bases: Env

Simulation of ELVRocket control object for training AI agents.

State order: [alpha, q, theta] in SI units (rad, rad/s, rad). Action: elevator in radians.

Parameters:

Name Type Description Default
initial_state Union[ndarray, list[float]]

Initial state [alpha, q, theta] in SI units (radians).

required
reference_signal Union[ndarray, Callable]

Reference signal (radians for angular states).

required
number_time_steps int

Number of simulation steps.

required
tracking_states Optional[List[str]]

Tracked states.

None
state_space Optional[List[str]]

State space.

None
control_space Optional[List[str]]

Control space.

None
output_space Optional[List[str]]

Full output space (including noise).

None
reward_func Optional[Callable]

Reward function (WIP status).

None

Initialize ELV longitudinal environment.

reward(state, ref_signal, ts) staticmethod

Evaluate control performance.

Parameters:

Name Type Description Default
state _type_

Current state.

required
ref_signal _type_

Reference state.

required
ts _type_

Time step.

required

Returns:

Name Type Description
reward float

Control performance evaluation.

step(action)

Execute a simulation step.

Parameters:

Name Type Description Default
action ndarray

Array of control signals in radians.

required

Returns:

Name Type Description
next_state ndarray

Next state of the control object.

reward ndarray

Evaluation of control algorithm actions.

done bool

Simulation status, whether completed or not.

logging any

Additional information (not used).

reset(seed=None, options=None)

Reset simulation environment to initial conditions.

Parameters:

Name Type Description Default
seed int

Seed for random number generator.

None
options dict

Additional options for initialization.

None

render()

Visual display of actions in the environment. Status: WIP.

Raises:

Type Description
NotImplementedError

Rendering is not implemented for this environment.