Перейти к содержанию

Ракета‑носитель ELV — продольная динамика

ELV (Expendable Launch Vehicle) — ракета‑носитель для выведения полезной нагрузки на орбиту. Реализован продольный канал полёта как линейная модель в пространстве состояний и совместимая среда Gymnasium.

Expendable launch vehicle

  • Быстрый старт

    Запустите среду или модель за минуты.

    К примеру

  • API модели

    Документация Python‑класса модели ELV.

    К API

  • Среда Gymnasium

    Готовая среда для RL‑агентов.

    К среде

  • Теория

    Уравнения состояния и численные параметры.

    К модели

Как устроен объект управления

Модель задана в пространстве состояний:

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

Где:

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

Типовая структура матриц:

\[ \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: нормальная скорость, м/с
  • q: угловая скорость тангажа, рад/с
  • θ: тангаж, рад
  • η: управляющее воздействие (орган тангажа), рад
  • z_w, z_q, z_θ — частные производные нормальной силы \(Z\) по \(w, q, \theta\)
  • m_w, m_q, m_θ — частные производные момента тангажа \(M\) по \(w, q, \theta\)
  • z_η, m_η — частные производные по управляющему воздействию \(\eta\)

О единицах измерения

Углы и угловые скорости — в радианах. Методы API позволяют работать в градусах.

Математическая модель

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

Численные матрицы (пример линеаризации):

\[ \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 \]

Производные (численные значения)

  • Матрица A (производные):
Коэффициент Значение
z_w -100.858
z_q 1.0
z_θ -0.1256
m_w 14.7805
m_q 0.0
m_θ 0.01958
  • Вход η (столбец B):
Коэффициент Значение
z_η 0.0
m_η 3.4558

Ограничения привода

По умолчанию применяются предельные значения управления:

  • Максимальная величина: \(\pm 25^\circ\)
  • Максимальная скорость изменения: \(60^\circ/\text{s}\)

Внутренние вычисления — в радианах; ограничения переводятся эквивалентно.

Источники

  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. Ссылка
  2. Aliyu, Bhar. (2011). Expendable Launch Vehicle Flight Control — Design & Simulation with Matlab/Simulink. Ссылка

Награда

Функция награды по умолчанию возвращает отрицательную абсолютную ошибку отслеживания угла тангажа:

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

Чем выше награда (ближе к 0), тем лучше качество отслеживания. Пользовательская функция награды может быть передана через параметр reward_func.

Быстрый старт

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]])  # управление (рад)
    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.