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

Спутник связи (ComSat) — продольная динамика

Искусственный спутник связи — аппарат на орбите для ретрансляции и обработки радиосигналов. Страница оформлена по аналогии с ELV: быстрый старт, математика, таблицы производных и API.

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

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

    К примеру

  • API модели

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

    К API

  • Среда Gymnasium

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

    К среде

  • Теория

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

    К модели

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

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

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

Где:

\[ x = \begin{bmatrix} x_1 \\ x_3 \\ x_4 \end{bmatrix} = \begin{bmatrix} \rho \\ \dot{\rho} \\ \dot{\theta} \end{bmatrix}, \quad u = u_2 \]

Линеаризованная система:

\[ \begin{bmatrix} \dot{x}_1 \\ \dot{x}_3 \\ \dot{x}_4 \end{bmatrix} = \begin{bmatrix} 0 & 1 & 0 \\ 0.01036 & 0 & 0.7753 \\ 0 & -0.01775 & 0 \end{bmatrix} \begin{bmatrix} x_1 \\ x_3 \\ x_4 \end{bmatrix} + \begin{bmatrix} 0 \\ 0 \\ 0.1513 \end{bmatrix} u_2 \]
  • x₁ = ρ: радиальная позиция — расстояние от центра Земли, км
  • x₃ = ρ̇: радиальная скорость, м/с
  • x₄ = θ̇: угловая скорость, рад/с
  • u₂: тангенциальная тяга, Н
    • u₂ > 0 — тяга по направлению движения (ускорение спутника)
    • u₂ < 0 — тяга против направления движения (торможение)
    • u₂ = 0 — тяга отсутствует
  • a₁₃ = 1.0 — радиальная позиция изменяется согласно радиальной скорости
  • a₃₁ = 0.01036 — компонента радиального ускорения от позиции
  • a₃₄ = 0.7753 — компонента радиального ускорения от угловой скорости
  • a₄₃ = -0.01775 — компонента углового ускорения от радиальной скорости
  • b₄ = 0.1513 — влияние тангенциальной тяги на угловое ускорение

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

Угловые скорости — в радианах. Позиция в км, скорость в м/с. Методы API поддерживают преобразование единиц.

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

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

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

\[ \begin{bmatrix} \dot{x}_1 \\ \dot{x}_3 \\ \dot{x}_4 \end{bmatrix} = \begin{bmatrix} 0 & 1 & 0 \\ 0.01036 & 0 & 0.7753 \\ 0 & -0.01775 & 0 \end{bmatrix} \begin{bmatrix} x_1 \\ x_3 \\ x_4 \end{bmatrix} + \begin{bmatrix} 0 \\ 0 \\ 0.1513 \end{bmatrix} u_2 \]

Развёрнутая форма: [ \begin{aligned} \dot{x}_1 &= x_3 \ \dot{x}_3 &= 0.01036 \cdot x_1 + 0.7753 \cdot x_4 \ \dot{x}_4 &= -0.01775 \cdot x_3 + 0.1513 \cdot u_2 \end{aligned} ]

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

  • Матрица A (производные по состояниям):
Коэффициент Значение Физический смысл
a₁₃ (∂ẋ₁/∂x₃) 1.0 Скорость изменения радиальной позиции = радиальная скорость
a₃₁ (∂ẋ₃/∂x₁) 0.01036 Влияние позиции на радиальное ускорение
a₃₄ (∂ẋ₃/∂x₄) 0.7753 Влияние угловой скорости на радиальное ускорение
a₄₃ (∂ẋ₄/∂x₃) -0.01775 Влияние радиальной скорости на угловое ускорение
  • Матрица B (управляющее воздействие):
Коэффициент Значение Физический смысл
b₄ (∂ẋ₄/∂u₂) 0.1513 Влияние тангенциальной тяги на угловое ускорение

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

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

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

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

Источники

  1. Santosh Kumar Choudhary (2015). Design and Analysis of an Optimal Orbit Control for a Communication Satellite. INTERNATIONAL JOURNAL OF COMMUNICATIONS. Volume 9, 2015

Награда

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

\[r_t = -|\dot{\rho}(t) - \dot{\rho}_{\text{ref}}(t)|\]

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

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

import gymnasium as gym
import numpy as np

from tensoraerospace.envs import ComSatEnv
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=0.1, tp=tp, time_step=10, output_rad=True).reshape(1, -1)

env = gym.make(
    'ComSatEnv-v0',
    number_time_steps=number_time_steps,
    initial_state=[[6371.0], [0.0], [0.001]],  # [rho (км), rho_dot (м/с), theta_dot (рад/с)]
    reference_signal=reference_signals,
)
state, info = env.reset()
for _ in range(200):
    action = np.array([[0.1]])  # Тангенциальная тяга u2
    state, reward, terminated, truncated, info = env.step(action)
    if terminated or truncated:
        break
import numpy as np
from tensoraerospace.aerospacemodel import ComSat

dt = 0.01
number_time_steps = 200

# Начальное состояние: [rho (км), rho_dot (м/с), theta_dot (рад/с)]
x0 = np.array([6371.0, 0.0, 0.001])

model = ComSat(
    x0=x0,
    number_time_steps=number_time_steps,
    selected_state_output=["rho", "rho_dot", "theta_dot"],
    dt=dt,
)

for t in range(number_time_steps - 1):
    u = np.array([[0.05]])  # Тангенциальная тяга u2
    x_next = model.run_step(u)

# Получение истории состояний
rho_history = model.get_state('rho')
rho_dot_history = model.get_state('rho_dot')
theta_dot_history = model.get_state('theta_dot')

Python API

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

Bases: ModelBase

Communication satellite 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

u2: tangential thrust (N) - positive accelerates satellite, negative decelerates

State space

rho: radial position - distance from Earth center [km] rho_dot: radial velocity [m/s] theta_dot: angular velocity [rad/s]

Output space

rho: radial position - distance from Earth center [km] rho_dot: radial velocity [m/s] theta_dot: angular velocity [rad/s]

Initialize ComSat 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.

State vector: x = [x₁, x₃, x₄]ᵀ = [rho, rho_dot, theta_dot]ᵀ Control: u = u₂ (tangential thrust)

Equations: ẋ₁ = x₃ (radial position rate = radial velocity) ẋ₃ = 0.01036·x₁ + 0.7753·x₄ (radial acceleration) ẋ₄ = -0.01775·x₃ + 0.1513·u₂ (angular acceleration)

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 (e.g., rho, rho_dot, theta_dot).

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 name (e.g., u2).

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.

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

Bases: Env

Gymnasium environment for a communication satellite longitudinal model.

Parameters:

Name Type Description Default
initial_state ndarray | list[float]

Initial state.

required
reference_signal ndarray | Callable

Reference signal.

required
number_time_steps int

Number of simulation steps.

required
tracking_states list[str] | None

Tracked states.

None
state_space list[str] | None

State space.

None
control_space list[str] | None

Control space.

None
output_space list[str] | None

Full output space (including noise).

None
reward_func Callable | None

Reward function (WIP status).

None

Initialize communication satellite environment.

reward(state, ref_signal, ts) staticmethod

Compute tracking reward (negative absolute error).

step(action)

Run one environment step (Gymnasium API).

reset(seed=None, options=None)

Reset environment to the initial state (Gymnasium API).

render(mode=None)

Render a lightweight telemetry snapshot.

The legacy ComSat environment does not ship a graphical viewer. Human mode prints one concise state line; ansi returns it as a string for tests and logging.