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

Benchmark

Инструменты для объективного сравнения систем управления по стандартным метрикам.

Пример отчёта бенчмарка

Что оцениваем

  • Перерегулирование
  • Время переходного процесса
  • Степень затухания
  • Статическую ошибку

API

ControlBenchmark

Class for control system evaluation and beautiful plot generation.

Provides tools for analyzing transient process quality in automatic control systems with results visualization.

becnchmarking_one_step = benchmarking_one_step class-attribute instance-attribute

benchmarking_one_step(control_signal, system_signal, signal_val, dt)

Evaluate control system on one step and return extended set of results as dictionary.

Parameters:

Name Type Description Default
control_signal ndarray

System control signal.

required
system_signal ndarray

System signal that is affected by control.

required
signal_val float

Signal value from which the step function begins.

required
dt float

Discretization step.

required

Returns:

Name Type Description
dict dict

Dictionary with control system evaluation results: - "overshoot" (float): overshoot (%), - "settling_time" (float): settling time (s), - "damping_degree" (float): damping degree, - "static_error" (float): static error, - "rise_time" (float): rise time (s), - "peak_time" (float): peak time (s), - "maximum_deviation" (float): maximum deviation, - "iae" (float): integral absolute error, - "ise" (float): integral squared error, - "itae" (float): integral time absolute error, - "oscillation_count" (int): oscillation count, - "steady_state_value" (float): steady state value, - "performance_index" (float): comprehensive quality index.

plot(control_signal, system_signal, signal_val, dt, tps, figsize=(1600, 1000), title='Control System Analysis')

Build interactive control system analysis plot using Plotly.

Parameters:

Name Type Description Default
control_signal ndarray

System control signal.

required
system_signal ndarray

System signal that is affected by control.

required
signal_val float

Signal value from which the step function begins.

required
dt float

Discretization step.

required
tps ndarray

Array of time stamps.

required
figsize tuple

Plot size in pixels, defaults to (1600, 1000).

(1600, 1000)
title str

Plot title.

'Control System Analysis'

compare_systems(systems_data, signal_val, dt, figsize=(1800, 1200))

Compare multiple control systems on a single interactive plot.

Parameters:

Name Type Description Default
systems_data Dict[str, Dict]

Mapping from system name to a dictionary with keys: - control_signal: reference/command signal (np.ndarray) - system_signal: system response (np.ndarray) - time: time stamps for plotting (np.ndarray)

required
signal_val float

Threshold value used to detect the step start.

required
dt float

Discretization time step used for metric conversions.

required
figsize tuple

Plot size in pixels. Defaults to (1800, 1200).

(1800, 1200)

Returns:

Type Description
Dict[str, Dict]

Dict[str, Dict]: Mapping from system name to computed metrics.

generate_report(control_signal, system_signal, signal_val, dt, system_name='Система управления')

Generate a formatted text report with control quality metrics.

Parameters:

Name Type Description Default
control_signal ndarray

Reference/command signal.

required
system_signal ndarray

System response signal.

required
signal_val float

Threshold value used to detect the step start.

required
dt float

Discretization time step.

required
system_name str

Label used in the report header.

'Система управления'

Returns:

Name Type Description
str str

Formatted report string.

Пример использования

from tensoraerospace.benchmark import ControlBenchmark

bench = ControlBenchmark()
metrics = bench.benchmarking_one_step(control_signal, system_signal, 1.0, dt)

print("Статическая ошибка:", metrics['static_error'])
print("Время переходного процесса:", metrics['settling_time'])
print("Степень затухания:", metrics['damping_degree'])
print("Перерегулирование:", metrics['overshoot'])

# Визуализация сравнения сигналов и метрик
bench.plot(control_signal, system_signal, 1.0, dt, tps, figsize=(15, 5))

Единицы и входные данные

  • control_signal, system_signal — массивы одинаковой длины
  • 1.0 — желаемое установившееся значение (пример)
  • dt — шаг дискретизации; tps — временная ось

Обратная совместимость

Старое имя метода becnchmarking_one_step по-прежнему работает как псевдоним для benchmarking_one_step для обеспечения обратной совместимости.