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

LSU‑05 NG — продольная динамика

LAPAN Surveillance Aircraft (LSU)‑05 NG — БПЛА для наблюдений и исследований. Страница оформлена по аналогии с ELV: быстрый старт, математика, производные и API.

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

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

    К примеру

  • API модели

    Документация Python‑класса продольной динамики LSU‑05.

    К API

  • Среда Gymnasium

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

    К среде

  • Теория

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

    К модели

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

\[\dot{x} = A x + B u, \quad y = C x + D u\]
\[ x = \begin{bmatrix} u & w & q & \theta \end{bmatrix}^{\top}, \quad u_{in} = \eta \]

Типовая структура и численные матрицы:

Объект управления построен в форме пространства состояний — как и большинство объектов управления в данной библиотеке. Значения матриц взяты из источников ниже.

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

\[ \dot{x} = A x + B u, \qquad y = C x + D u \]
\[ \begin{bmatrix} \dot{u} \\ \dot{w} \\ \dot{q} \\ \dot{\theta} \end{bmatrix} = \begin{bmatrix} -0.00271615 & 0.248462 & 0 & -9.81 \\ -0.257616 & -11.3097 & 68.9497 & 0\\ 0.0576336 & -7.23232 & -11.3237 & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} u \\ w \\ q \\ \theta \end{bmatrix} + \begin{bmatrix} 1.959083 \\ -73.99448 \\ -188.4752 \\ 0.0 \end{bmatrix} \eta \]

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

  • Матрица A (производные):
Коэффициент Значение
x_u -0.00271615
x_w 0.248462
x_q 0
x_θ -9.81
z_u -0.257616
z_w -11.3097
z_q 68.9497
z_θ 0
m_u 0.0576336
m_w -7.23232
m_q -11.3237
m_θ 0
  • Вход η (столбец B):
Коэффициент Значение
x_η 1.959083
z_η -73.99448
m_η -188.4752

где

  • :math:u Продольная скорость ЛА [м/с]
  • :math:w Нормальная скорость ЛА [м/с]
  • :math:q Угловая скорость Тангажа [град/с]
  • :math:\theta - Тангаж [град]
  • :math:\eta - Угол отклонения стабилизатора [град]
  • :math:x_u - частная производная продольной силы по продольной скорости
  • :math:x_w - частная производная продольной силы по нормальной скорости
  • :math:x_q - частная производная продольной силы по угловой скорости
  • :math:x_{\theta} - частная производная продольной силы по углу тангажа
  • :math:z_u - частная производная вертикальной силы по продольной скорости
  • :math:z_w - частная производная вертикальной силы по нормальной скорости
  • :math:z_q - частная производная вертикальной силы по угловой скорости
  • :math:z_{\theta} - частная производная вертикальной силы по углу тангажа
  • :math:m_u - частная производная момента тангажа по продольной скорости
  • :math:m_w - частная производная момента тангажа по нормальной скорости
  • :math:m_q - частная производная момента тангажа по угловой скорости
  • :math:m_{\theta} - частная производная момента тангажа по углу тангажа

Источники

    1. Lembaga, D.O., Antariksa, P.D., Septiyana, A., Hidayat, K., Rizaldi, A., Suseno, P.A., Jayanti, E.B., Atmasari, N., Ramadiansyah, M.L., Ramadhan, R.A., Suryo, V.N., Grüter, B., Diepolder, J., Holzapfel, F., Wijaya, Y.G., Dewan, S., Jurnal, P., Dirgantara, T., Wibowo, H., Panas, P., Septanto, H., Harno, A., Syah, N.A., Angkasa, R., Satelit, M.D., Irwanto, H.Y., Avionik, M.E., Hakim, A.N., Utama, A.B., Wahyudi, A.H., Kurniawati, F., Putro, I.E., & Astuti, R.A. STABILITY AND CONTROLLABILITY ANALYSIS ON LINEARIZED DYNAMIC SYSTEM EQUATION OF MOTION OF LSU 05-NG USING KALMAN RANK CONDITION METHOD. - Jurnal Teknologi Dirgantara Vol. 18 No. 2 Desember 2020 : hal 81 – 92 – 2020

Награда

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

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

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

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

```python

import gymnasium as gym 
import numpy as np
from tqdm import tqdm

from tensoraerospace.envs import LinearLongitudinalLAPAN
from tensoraerospace.utils import generate_time_period, convert_tp_to_sec_tp
from tensoraerospace.signals.standard import unit_step

dt = 0.01  # Дискретизация
tp = generate_time_period(tn=20, dt=dt) # Временной периуд
tps = convert_tp_to_sec_tp(tp, dt=dt)
number_time_steps = len(tp) # Количество временных шагов
reference_signals = np.reshape(unit_step(degree=5, tp=tp, time_step=10, output_rad=True), [1, -1]) # Заданный сигнал

env = gym.make(
    'LinearLongitudinalLAPAN-v0',
    number_time_steps=number_time_steps, 
    initial_state=[[0],[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

Python API

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

Bases: ModelBase

LAPAN Surveillance Aircraft (LSU)-05 NG 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

u: Longitudinal aircraft velocity [m/s] w: Normal aircraft velocity [m/s] q: Pitch angular velocity [rad/s] theta: Pitch [rad]

Output space

u: Longitudinal aircraft velocity [m/s] w: Normal aircraft velocity [m/s] q: Pitch angular velocity [rad/s] theta: Pitch [rad]

Initialize LAPAN instance.

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 list[str] | None

Selected states of the control object. Defaults to None.

None
t0 float

Initial time. Defaults to 0.

0
dt float

Discretization frequency. Defaults to 0.01.

0.01

import_linear_system()

Load (set) stored linearized system matrices.

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').

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

LinearLongitudinalLAPAN(initial_state, reference_signal, number_time_steps, tracking_states=None, state_space=None, control_space=None, output_space=None, reward_func=None)

Bases: Env

Legacy LAPAN longitudinal-control environment.

Parameters:

Name Type Description Default
initial_state ndarray

Initial state vector.

required
reference_signal ndarray

Reference (target) signal array.

required
number_time_steps int

Number of simulation steps.

required
tracking_states list[str] | None

Names of tracked states used for reward computation.

None
state_space list[str] | None

Names of state variables exposed in observations.

None
control_space list[str] | None

Names of control inputs.

None
output_space list[str] | None

Names of model outputs returned by the plant.

None
reward_func Callable[[ndarray, ndarray, int], float] | None

Optional custom reward function.

None

Initialize legacy LAPAN longitudinal environment.

reward(state, ref_signal, ts) staticmethod

Compute tracking reward for the current step.

Parameters:

Name Type Description Default
state ndarray

Current tracked state vector.

required
ref_signal ndarray

Reference signal array.

required
ts int

Current time step index.

required

Returns:

Name Type Description
float float

Reward value (lower is better in the legacy formulation).

step(action)

Run one simulation step.

Parameters:

Name Type Description Default
action ndarray

Control input(s).

required

Returns:

Name Type Description
tuple ndarray

(observation, reward, terminated, truncated, info) in the

float

Gymnasium API format.

reset(seed=None, options=None)

Reset environment state to the initial conditions.

Parameters:

Name Type Description Default
seed int | None

Random seed (Gymnasium).

None
options dict | None

Optional reset options (unused).

None

Returns:

Name Type Description
tuple tuple[ndarray, dict[str, float]]

(observation, info).

render()

Render the environment (not implemented).

Raises:

Type Description
NotImplementedError

Rendering is not available.