Многочастотный расчёт

Многочастотный расчёт позволяет получить характеристики устройства сразу на многих частотах за один проход ядра — вместо отдельного расчёта на каждой частоте. В этом разделе описано, как его задать, где смотреть результат и о чём помнить.

Изменения по исправлениям 26.10.2026 (версия 5.1): окно SMATRIX теперь учитывается, добавлено предупреждение о незатухшем отклике, ошибка на одной частоте больше не обрывает обработку остальных, уточнено окно диаграммы направленности (пп. 4.1, 5.1, 7).


1. Зачем это нужно

Частотная характеристика (например, |S21| в полосе 3–5 ГГц) — это много точек по частоте.

Старый способ — свип по частоте. На каждую частоту в задании пишется отдельный шаг #STEP со своей FREQ; на входе — синусоида этой частоты. Каждый шаг — полный расчёт. Десять частот — десять расчётов.

Новый способ — падающая волна из файла. На вход подаётся сигнал, в котором есть все нужные частоты сразу (например, сумма десяти синусоид). Расчёт один; затем сигнал на портах раскладывается по частотам, и получается S-матрица на всех частотах.

Схема расчёта линейна, поэтому отклик на сумму частот равен сумме откликов на каждую из них. Широкополосный проход стоит столько же, сколько один одночастотный, и выигрыш по времени растёт пропорционально числу частот.

Проверка на примере samples/MULTIFREQ (волновод 60 мм со вставкой ε = 2, полоса 3,0–4,8 ГГц, 10 частот, ядро H):

Способ Время счёта Расхождение с эталонным свипом
свип, 10 шагов 35,1 с — (эталон)
один проход 4,5 с 0,0016 дБ; 0,01°

То есть один проход в 7,8 раза быстрее при практически тех же числах.

Проверено также на семи средах (X-ядро; пустой канал, диэлектрик, ε из файла, магнитные стенки, поглотитель, плазма N, плазма N + B): значения nan не возникло ни разу; размер области и мелкость сетки на точность метода не влияют (задача 321 тыс. узлов — 0,0005 дБ / 0,006°).


2. Как задать падающую волну из файла

2.1. Синтаксис в задании .tpl

У входа (INPUT_X или INPUT_Y) на месте параметра амплитуды Amp пишется имя файла в квадратных скобках — так же, как у блоков задаётся распределение ε:

INPUT_X ; ylo; yhi; Tmin; Tmax; [wg_multi]; 0;

Правила:

  • расширение .sig ядро дописывает само — в задании имя пишется без расширения;
  • файл ищется рядом с заданием .tpl;
  • файл задаёт всю падающую волну a(t); параметр фазы Faza для этого входа не используется;
  • FREQ в #PARM по-прежнему нужна: по ней ядро согласует порт. Её ставят в центр полосы (для полосы 3,0–4,8 ГГц — 3,9 ГГц);
  • окно Tmin..Tmax входа действует как обычно: что в файле длиннее окна — обрезается, чего не хватает — дополняется нулями;
  • если квадратных скобок нет — вход работает ровно как раньше.

Пассивный (приёмный) порт задаётся как обычно.

2.2. Пример задания

Фрагмент samples/MULTIFREQ/wg_wide.tpl (один шаг, падающая волна из wg_multi.sig):

#PARM
 ANGLE_UNIT radian;
 FREQ_UNIT  GHz;
 LONG_UNIT  mm;
 TIME_UNIT  ns;
 DELTA  1;
 TIME   0.; 40;
 X_MIN  0.0;
 X_MAX  200;
 Y_MIN  0.0;
 Y_MAX  84;
 FREQ   3.9;
#END_PARM
...
 BLOCK 7;
  INPUT_X ; 12; 72; 0; 40; [wg_multi]; 0;
 END_B
 BLOCK 12;
  INPUT_X ; 12; 72; 9000; 9999; 0; 0;
 END_B
...
#OUTPUT
 FILE wg_wide;
#END_OUTPUT

Здесь блок 7 — левый, возбуждающий порт (сигнал из файла wg_multi.sig, окно 0–40 нс), блок 12 — правый, приёмный порт.

Для сравнения — один шаг старого свипа из samples/MULTIFREQ/wg_sweep.tpl (таких шагов десять, у каждого своя FREQ):

 FREQ   3;
...
 BLOCK 7;
  INPUT_X ; 12; 72; 0; 40; 1; 0;
 END_B
...
#OUTPUT
 FILE wg_s30;
 SMATRIX wg_sweep; 3; 30; 40;
#END_OUTPUT

В свипе (одночастотный режим) частота в SMATRIX обязана совпадать с FREQ шага, а окно Tmin; Tmax; обязательно (Файл задания .tpl, раздел 7.4).

2.3. Формат файла .sig

Текстовый файл, две колонки:

  1. время — в единицах TIME_UNIT задания (в примерах — нс);
  2. значение падающей волны a(t) — безразмерное.
! t[ns]              a
#FREQ 3.0 3.2 3.4 3.6 3.8 4.0 4.2 4.4 4.6 4.8
    0.00000000   0.000000000e+00
    0.00250000   1.222110931e+00
Строка Смысл
начинается с ! комментарий, пропускается
#FREQ f1 f2 … список частот, которые есть в сигнале, в единицах FREQ_UNIT задания
два числа отсчёт «время, значение»

Между отсчётами ядро линейно интерполирует; вне диапазона файла значение равно нулю. Шаг по времени в файле может быть любым, но его лучше брать мельче шага ядра, иначе интерполяция огрубит сигнал. Шаг ядра по времени равен DELTA / (c·√2): при DELTA = 1 мм это 0,00236 нс. Проверка: шаг файла вдвое крупнее шага ядра дал ошибку 7·10⁻³, вдвое мельче — 6·10⁻⁵.

Строка #FREQ обязательна для многотонального сигнала (суммы синусоид). Ядро переносит её в заголовок файла .t, и постобработка берёт частоты точными. Без неё частоты приходится искать по спектру, а это принципиально неточно: соседние тоны смещают пики друг друга (на примере пик пришёлся на 2,9973 ГГц вместо 3,000 ГГц, и результат разошёлся на 0,7 дБ вместо 0,002 дБ).

Для импульса (один период, ЛЧМ, гауссов радиоимпульс) строка #FREQ не нужна: спектр гладкий, и постобработка находит полосу сама (проверка на импульсе из одного периода — 0,0086 дБ и 0,073° против эталонного свипа).

2.4. Как сделать файл .sig

Проще всего — в TPL Designer: на стартовом экране карточка «Вспомогательные файлы» → кнопка «Сделать файл».

Стартовый экран TPL Designer
Стартовый экран TPL Designer

Рисунок 1. Стартовый экран TPL Designer; файл .sig создаётся через карточку «Вспомогательные файлы».

Окно создания файла падающей волны в TPL Designer
Окно создания файла падающей волны в TPL Designer

Рисунок 2. Создание файла .sig в TPL Designer: форма сигнала («Гребёнка тонов», ЛЧМ, радиоимпульс и др.), полоса частот и число тонов, шаг сетки и время счёта задания, имя файла; внизу — сигнал и его спектр. Строку #FREQ программа пишет сама.

Файл можно задать и прямо при настройке порта в TPL Designer (переключатель «Откуда сигнал: Файлом сигнала»). Подробно — TPL Designer.


3. Два вида широкополосного сигнала

Сигнал Когда кончается Как раскладывается по частотам
непрерывный многотон (сумма синусоид, как в wg_multi.sig) не кончается, идёт весь расчёт подгонка гармоник на установившемся участке
импульс (один период, ЛЧМ, гауссов) затухает внутри интервала счёта интеграл по всему интервалу

Вид сигнала программа определяет сама — по уровню падающей волны в конце расчёта. Выбирать ничего не нужно.

Рекомендации по длительности счёта:

  • для многотона время TIME должно быть достаточным, чтобы отклик установился;
  • для импульса считайте, пока устройство не «отзвенит»: на высокодобротном резонаторе недосчитанный интервал давал ошибку до 2 дБ и 15°, после затухания — 0,6 дБ и 3°. Если отклик к концу окна SMATRIX не затух, ядро выдаёт предупреждение (п. 4.1).

4. S-матрица на всех частотах

Получить .s можно двумя путями — результат одинаковый (совпадает бит в бит).

4.1. Сразу из ядра: строка SMATRIX

Добавьте в #OUTPUT строку SMATRIX — ядро само распознает широкополосный расчёт и запишет в .s все частоты полосы. Фрагмент samples/MULTIFREQ/wg_wide_s.tpl:

#OUTPUT
 FILE wg_wide_s;
 SMATRIX wg_wide_s; 3.9; 30; 40;
#END_OUTPUT

Частота в строке SMATRIX (здесь 3,9) для широкополосного расчёта не используется — частоты ядро берёт из сигнала, — но остаётся обязательным параметром языка задания. В многочастотном режиме ядро не сверяет её с FREQ.

Окно Tmin…Tmax (здесь 30…40 нс) с 26.10.2026 учитывается: для разложения по частотам берутся только отсчёты внутри окна. Раньше многочастотная обработка окно не учитывала и брала все отсчёты файла .t.

  • Запись без окна — SMATRIX wg_wide_s; 3.9; — означает полное окно 0…Tmax задания. Это вариант по умолчанию для многочастотного режима; он даёт ровно тот же результат, что прежняя обработка без учёта окна.
  • Если в старом задании окно было указано (например, 30; 40 при TIME 0.; 40;), теперь оно действует, и результат может измениться. Чтобы получить прежний результат, уберите окно.
  • Предупреждение о незатухшем отклике. Если отклик импульса к концу окна не затух (в последних 5 % окна уровень больше 1 % пика) или окно начинается, когда падающий импульс ещё идёт, ядро выдаёт предупреждение в консоль и строку состояния, например the response has not died away by the end of the window … 4.5 % of its peak или the window starts while the pulse is running …. S-матрица при этом записывается; проверьте окно и время счёта TIME. После конца расчёта текст предупреждения остаётся в строке состояния, а слева стоит жёлтая надпись «Готово, есть предупреждения».
Строка состояния ядра: предупреждение о незатухшем отклике
Строка состояния ядра: предупреждение о незатухшем отклике

Рисунок 3. Строка состояния ядра после многочастотного расчёта со слишком коротким окном SMATRIX: отклик к концу окна не затух (4,5 % пика).

Участок подгонки многотона (ответ автора 29.10.2026). Для непрерывного многотона участок подгонки гармоник — ровно то окно, которое задано в строке SMATRIX; если задано всё окно, подгонка ведётся по всему окну. Автоматически участок не выбирается.

Окно в TPL Designer. Окно задаётся в разделе «Вывод данных», группа «Матрица рассеяния (TMCGROUT)». Если в задании есть возбуждаемый вход с файлом сигнала, в группе появляется флажок «Ограничить окно (вход с файлом сигнала)» (в английском интерфейсе — «Limit the window (port with a signal file)»):

  • снят (по умолчанию) — программа пишет строку без окна, SMATRIX имя; F; (полное окно 0…TIME); поля «Окно снятия от / до» недоступны;
  • отмечен — пишется окно из полей «Окно снятия от / до».

Окно, которое кончается позже TIME, проверка TPL Designer считает ошибкой (файл был бы пуст). Подробно — tpl_designer.md, раздел 9.

4.2. Потом, в TMCROS: «В S-матрицу»

Если SMATRIX в задании не было, откройте полученный .t в TMCROS и выполните команду Правка → В S-матрицу. TMCROS сам видит в заголовке .t признак широкополосного расчёта и строит S-матрицу сразу на всей сетке частот. Окно Tmin…Tmax этого окна TMCROS тоже учитывает, а предупреждение о незатухшем отклике показывает окном сообщения.

Сообщение TMCROS о незатухшем отклике
Сообщение TMCROS о незатухшем отклике

Рисунок 4. Сообщение TMCROS после «В S-матрицу» для широкополосного .t с коротким окном: S-матрица записана, но отклик к концу окна не затух.

Окно «Экспорт временного сигнала в S-матрицу»
Окно «Экспорт временного сигнала в S-матрицу»

Рисунок 5. Окно TMCROS «Экспорт временного сигнала в S-матрицу» (на снимке — обычный, одночастотный файл poly.t). Подробно об элементах окна — TMCROS.

4.3. Поправка на рассогласование порта

Порт с металлическими стенками (волна H₁₀) согласован ядром на одной частоте — FREQ. На других частотах полосы он немного отражает: без поправки на примере wg_wide это давало 0,81 дБ и 11,06°, а фон |S11| пустого канала — около −14 дБ. Обе программы (ядро при SMATRIX и TMCROS) автоматически снимают это рассогласование по формуле перенормировки проводимости порта; параметры порта (шаг сетки, апертура, FREQ) берутся из заголовка .t, у пользователя ничего не спрашивается. После поправки расхождение со свипом — 0,0016 дБ и 0,01°.

Для входа с магнитными стенками (MAGNETIC, плоская волна) рассогласования нет: проводимость такого порта от частоты не зависит.

Ограничение (уточнено автором 29.10.2026). Поправка порта в многочастотном режиме рассчитана на одинаковые порты и симметричное устройство: значение Gamma возбуждённого порта ставится на оба порта. Для портов разной ширины или несимметричного устройства поправка неточна — для точного результата нужен свип по частотам. В будущем планируются многоканальный вход (частотный мультиплексор) и многоканальное возбуждение.

TPL Designer напоминает об этом при проверке задания: если при входе с файлом сигнала входы разной ширины или разной моды, появляется предупреждение «многочастотный расчёт: входы «…» (… мм) и «…» (… мм) разные…» (tpl_designer.md, раздел 9).

4.4. Что ядро пишет в .t

В заголовок файла сигналов широкополосного расчёта ядро добавляет строки:

#TMC_GROTS_Wideband 1
#TMC_GROTS_Port 7 0.001 0.06 3900000000 1
#TMC_GROTS_Port 12 0.001 0.06 3900000000 0

Первая — признак широкополосного расчёта. Остальные — по строке на порт: номер блока, шаг сетки (м), апертура (м), частота согласования (Гц) и признак «сигнал из файла» (1 — да, 0 — нет). Из #FREQ файла .sig в заголовок переносится также список частот (в герцах). Прежние версии программ эти строки пропускают — формат остался совместимым.


5. Многочастотная диаграмма направленности

5.1. Как задать

Если вход возбуждается файлом .sig с несколькими частотами и в #OUTPUT есть строка FIELD_DISTRIBUTION_M, ядро строит диаграмму направленности на каждой частоте и пишет отдельный файл на каждую:

<имя>_<частота в МГц>MHz.DAT

Пример (dn_mf.tpl, тот же волновод, сигнал wg_multi.sig из 10 тонов 3,0–4,8 ГГц):

#OUTPUT
 FILE dn_mf;
 FIELD_DISTRIBUTION_M dn_mf; 3.9; 30; 35;
#END_OUTPUT

Результат — десять файлов dn_mf_3000MHz.DAT … dn_mf_4800MHz.DAT. Последние два параметра строки (здесь 30 и 35 нс) — окно времени, на котором накапливается распределение поля.

Правила:

  • нужна именно строка FIELD_DISTRIBUTION_M. С FIELD_DISTRIBUTION (без _M) при многочастотном сигнале ядро останавливает расчёт с ошибкой «needs FIELD_DISTRIBUTION_M»;
  • ядро округляет длину окна накопления вверх до целого числа периодов. Если число периодов уже целое, лишний период не добавляется (с 26.10.2026; раньше добавлялся ещё один период, и окно могло уйти за конец расчёта TIME);
  • окно накопления должно кончаться раньше конца расчёта TIME (с учётом округления). Окно, кончающееся ровно на TIME, не закрывается: файлов ДН нет, ядро сообщает об ошибке (код 2). Если окно выходит за TIME, ядро выдаёт ошибку расчёта «Directional pattern window ends … after the calculation time» (рисунок ниже);
  • длину окна накопления лучше брать кратной 1/Δf, где Δf — разнос частот в сигнале (для тонов через 0,2 ГГц — 5 нс). Иначе соседние частоты «просачиваются» друг в друга: при окне 6 нс расхождение с отдельным одночастотным расчётом было 3,3 %, при окне 5 нс — 0,9 %.
Строка состояния ядра: окно ДН кончается после времени расчёта
Строка состояния ядра: окно ДН кончается после времени расчёта

Рисунок 6. Окно ДН (2,5…3,5 нс) кончается после конца расчёта (TIME = 3 нс): файлов ДН нет, «Готово с ошибками», код возврата 2.

5.2. ДН только по границе области

Диаграмма направленности строится по полю на контуре вокруг излучающей структуры. Поэтому ядро может хранить данные для неё не по всей сетке, а только в четырёх узких полосах вдоль краёв области. Это экономит память: например, на сетке 11 млрд узлов — порядка 48 МБ вместо 176 ГБ.

Режим «по границе» ядро включает само:

Случай Что хранится
одна частота, обычная задача вся область (как раньше)
одна частота, данные для ДН заняли бы больше четверти свободной оперативной памяти только границы
многочастотный сигнал (любой размер) только границы, на каждой частоте

В режиме «по границе» файлы .AMP/.FAZ (распределение поля по всей области) не записываются — пишутся только .DAT. Файлы .DAT при этом точно такие же: на проверочных задачах 200 × 200 и 1000 × 1000 узлов они совпали с расчётом по всей области число в число.

5.3. Как смотреть

Каждый файл .DAT открывается в TMC_DN (Файл → Открыть…). Чтобы сравнить диаграммы разных частот в одном окне, добавляйте файлы командой Правка → Добавить характеристику (Ctrl+A). Подробно — TMC_DN.

Главное окно TMC_DN
Главное окно TMC_DN

Рисунок 7. Главное окно TMC_DN (на снимке — пример r7.DAT, одночастотная ДН, 10 ГГц).


6. Где смотреть результат

Что Программа Файл
сигналы на портах (падающая волна из файла и отклики) TMCROS .t
S-матрица на всех частотах TMCGROUT .s
диаграммы направленности по частотам TMC_DN <имя>_<МГц>MHz.DAT

В TMCGROUT частотная характеристика выглядит так же, как после свипа: по оси X — частота, по оси Y — выбранная величина (|S|, фаза, КСВ и т. п.).

Главное окно TMCGROUT с частотной характеристикой
Главное окно TMCGROUT с частотной характеристикой

Рисунок 8. TMCGROUT с файлом f_diel_sweep.s (волновод со вставкой ε = 2, 10 частот 3,0–4,8 ГГц, по оси Y — КСВ). Этот файл получен старым способом — свипом из 10 шагов; многочастотный проход того же задания (f_diel_wide.tpl) даёт .s на тех же частотах.


7. Ограничения и особенности

  • .s дописывается, а не перезаписывается. За один широкополосный проход в .s добавляются сразу все частоты полосы. Перед повторным расчётом файл .s нужно удалить (вручную или кнопкой «Удалить» в окне «Экспорт временного сигнала в S-матрицу» TMCROS — она удаляет файл без вопроса). Если существующий .s не читается, ядро не заменяет его молча, а сообщает об ошибке.
  • Не больше 99 частот в одном .s. При большем числе частот ядро сообщает об ошибке записи .s (код возврата 2 в пакетном режиме).
  • Сверять со свипом можно только на частотах из списка тонов. На частоте, которой в сигнале нет, сравнивать нечего.
  • Ошибка на одной частоте не обрывает обработку (с 26.10.2026). На частотах с ошибкой (например, на частоте ниже критической частоты порта — ошибка «Frequency … is below cutoff of port») в .s записываются нули, остальные частоты считаются; в конце расчёта — код возврата 2. Раньше обработка останавливалась на первой плохой частоте, и .s не создавался.
  • S, не являющаяся числом (NaN или Inf — например, при расходящемся поле), — ошибка, а не NaN в файле .s.
  • Ширина полосы. Многомодовый режим (полоса выше второй критической частоты порта, волна H₂₀) не исследовался — держите полосу в пределах одномодового диапазона порта. TPL Designer подсказывает этот диапазон при настройке порта.
  • Поправка на рассогласование порта рассчитана на одинаковые порты и симметричное устройство (п. 4.3); для портов разной ширины или несимметричного устройства она неточна — нужен свип по частотам. На структурах с потерями отдельно не проверялась.
  • Шаг файла .sig должен быть мельче шага ядра по времени (п. 2.3).

8. Пошагово: свип за один проход

  1. Создайте файл падающей волны .sig в TPL Designer (п. 2.4) с нужной полосой и числом тонов либо возьмите готовый samples/MULTIFREQ/wg_multi.sig.
  2. Положите .sig в ту же папку, что и задание .tpl.
  3. В задании у возбуждающего входа на месте Amp напишите имя файла в скобках: [wg_multi].
  4. Поставьте FREQ в центр полосы.
  5. Оставьте один шаг #STEP; в #OUTPUT добавьте SMATRIX (п. 4.1). Для полного окна пишите строку без окна (SMATRIX имя; F;; в TPL Designer для этого флажок «Ограничить окно (вход с файлом сигнала)» оставьте снятым). Строки FIELDS; и TOPOLOGY; для скорости уберите.
  6. Удалите старый .s с тем же именем, если он есть.
  7. Откройте задание в ядре и запустите расчёт (Расчёт → Запуск, F5).
  8. Проверьте строку состояния: нет ли предупреждения о незатухшем отклике или сообщений об ошибках на частотах.
  9. Откройте полученный .s в TMCGROUT (кнопка «S-матрица» на панели ядра).

Multi-frequency computation

A multi-frequency computation gives the characteristics of a device at many frequencies at once in a single kernel pass — instead of a separate computation at each frequency. This section describes how to set it up, where to view the result and what to keep in mind.

Changes after the fixes of 26.10.2026 (version 5.1): the SMATRIX window is now taken into account, a warning about an undecayed response has been added, an error at one frequency no longer aborts the processing of the others, the radiation pattern window has been refined (Sec. 4.1, 5.1, 7).


1. Why it is needed

A frequency response (for example, |S21| in the 3–5 GHz band) consists of many frequency points.

The old way — a frequency sweep. For each frequency, a separate #STEP with its own FREQ is written in the task file; the port is fed with a sine wave of that frequency. Each step is a full computation. Ten frequencies — ten computations.

The new way — an incident wave from a file. The port is fed with a signal that contains all the required frequencies at once (for example, a sum of ten sine waves). There is one computation; then the signal at the ports is decomposed by frequency, and the S-matrix at all frequencies is obtained.

The computational scheme is linear, so the response to a sum of frequencies equals the sum of the responses to each of them. A wideband pass costs as much as one single-frequency pass, and the time gain grows in proportion to the number of frequencies.

A check on the samples/MULTIFREQ example (a 60 mm waveguide with an ε = 2 insert, band 3.0–4.8 GHz, 10 frequencies, H kernel):

Method Computation time Deviation from the reference sweep
sweep, 10 steps 35.1 s — (reference)
single pass 4.5 s 0.0016 dB; 0.01°

That is, a single pass is 7.8 times faster with practically the same numbers.

It has also been checked on seven media (X kernel; empty channel, dielectric, ε from a file, magnetic walls, absorber, plasma N, plasma N + B): a nan value never occurred; the size of the region and the fineness of the grid do not affect the accuracy of the method (a 321 thousand node task — 0.0005 dB / 0.006°).


2. How to specify an incident wave from a file

2.1. Syntax in the .tpl task file

For a port (INPUT_X or INPUT_Y), the file name in square brackets is written in place of the amplitude parameter Amp — in the same way as the ε distribution is specified for blocks:

INPUT_X ; ylo; yhi; Tmin; Tmax; [wg_multi]; 0;

Rules:

  • the kernel appends the .sig extension itself — in the task file the name is written without an extension;
  • the file is searched for next to the .tpl task file;
  • the file specifies the whole incident wave a(t); the phase parameter Faza is not used for this port;
  • FREQ in #PARM is still needed: the kernel uses it to match the port. It is set at the centre of the band (for the 3.0–4.8 GHz band — 3.9 GHz);
  • the Tmin..Tmax window of the port acts as usual: whatever in the file is longer than the window is cut off, whatever is missing is padded with zeros;
  • if there are no square brackets, the port works exactly as before.

A passive (receiving) port is specified as usual.

2.2. Example task file

A fragment of samples/MULTIFREQ/wg_wide.tpl (one step, the incident wave from wg_multi.sig):

#PARM
 ANGLE_UNIT radian;
 FREQ_UNIT  GHz;
 LONG_UNIT  mm;
 TIME_UNIT  ns;
 DELTA  1;
 TIME   0.; 40;
 X_MIN  0.0;
 X_MAX  200;
 Y_MIN  0.0;
 Y_MAX  84;
 FREQ   3.9;
#END_PARM
...
 BLOCK 7;
  INPUT_X ; 12; 72; 0; 40; [wg_multi]; 0;
 END_B
 BLOCK 12;
  INPUT_X ; 12; 72; 9000; 9999; 0; 0;
 END_B
...
#OUTPUT
 FILE wg_wide;
#END_OUTPUT

Here block 7 is the left, exciting port (the signal from the wg_multi.sig file, window 0–40 ns), block 12 is the right, receiving port.

For comparison — one step of the old sweep from samples/MULTIFREQ/wg_sweep.tpl (there are ten such steps, each with its own FREQ):

 FREQ   3;
...
 BLOCK 7;
  INPUT_X ; 12; 72; 0; 40; 1; 0;
 END_B
...
#OUTPUT
 FILE wg_s30;
 SMATRIX wg_sweep; 3; 30; 40;
#END_OUTPUT

In a sweep (single-frequency mode) the frequency in SMATRIX must coincide with the FREQ of the step, and the window Tmin; Tmax; is mandatory (Task file .tpl, Section 7.4).

2.3. Format of the .sig file

A text file with two columns:

  1. time — in the TIME_UNIT units of the task (ns in the examples);
  2. the value of the incident wave a(t) — dimensionless.
! t[ns]              a
#FREQ 3.0 3.2 3.4 3.6 3.8 4.0 4.2 4.4 4.6 4.8
    0.00000000   0.000000000e+00
    0.00250000   1.222110931e+00
Line Meaning
begins with ! a comment, skipped
#FREQ f1 f2 … the list of frequencies present in the signal, in the FREQ_UNIT units of the task
two numbers a "time, value" sample

Between samples the kernel interpolates linearly; outside the range of the file the value is zero. The time step in the file can be anything, but it is better to make it finer than the kernel step, otherwise the interpolation will coarsen the signal. The kernel time step equals DELTA / (c·√2): with DELTA = 1 mm this is 0.00236 ns. A check: a file step twice as coarse as the kernel step gave an error of 7·10⁻³, twice as fine — 6·10⁻⁵.

The #FREQ line is mandatory for a multitone signal (a sum of sine waves). The kernel transfers it to the header of the .t file, and the post-processing takes the frequencies exactly. Without it the frequencies have to be found from the spectrum, and this is inherently inaccurate: neighbouring tones shift each other's peaks (in the example the peak fell at 2.9973 GHz instead of 3.000 GHz, and the result deviated by 0.7 dB instead of 0.002 dB).

For a pulse (one period, LFM, Gaussian RF pulse) the #FREQ line is not needed: the spectrum is smooth, and the post-processing finds the band by itself (a check on a one-period pulse — 0.0086 dB and 0.073° versus the reference sweep).

2.4. How to make a .sig file

The easiest way is in TPL Designer: on the start screen, the Auxiliary files card → the Make a file button.

TPL Designer start screen
TPL Designer start screen

Figure 1. TPL Designer start screen; the .sig file is created through the Auxiliary files card.

The incident-wave file window in TPL Designer
The incident-wave file window in TPL Designer

Figure 2. Creating a .sig file in TPL Designer: the signal shape (Tone comb, LFM, RF pulse, etc.), the frequency band and the number of tones, the grid step and the computation time of the task, the file name; at the bottom — the signal and its spectrum. The program writes the #FREQ line itself.

The file can also be specified directly when setting up a port in TPL Designer (the Signal source: switch set to By signal file (any shape)). For details — TPL Designer.


3. Two kinds of wideband signal

Signal When it ends How it is decomposed by frequency
continuous multitone (a sum of sine waves, as in wg_multi.sig) does not end, lasts for the whole computation harmonic fitting on the steady-state interval
pulse (one period, LFM, Gaussian) decays within the computation interval integral over the whole interval

The program determines the kind of signal by itself — from the level of the incident wave at the end of the computation. There is nothing to choose.

Recommendations on the computation duration:

  • for a multitone, the time TIME must be sufficient for the response to settle;
  • for a pulse, compute until the device has stopped "ringing": on a high-Q resonator an insufficient interval gave an error of up to 2 dB and 15°, after decay — 0.6 dB and 3°. If the response has not decayed by the end of the SMATRIX window, the kernel issues a warning (Sec. 4.1).

4. S-matrix at all frequencies

The .s can be obtained in two ways — the result is the same (identical bit for bit).

4.1. Directly from the kernel: the SMATRIX line

Add a SMATRIX line to #OUTPUT — the kernel itself recognizes the wideband computation and writes all frequencies of the band to the .s. A fragment of samples/MULTIFREQ/wg_wide_s.tpl:

#OUTPUT
 FILE wg_wide_s;
 SMATRIX wg_wide_s; 3.9; 30; 40;
#END_OUTPUT

The frequency in the SMATRIX line (3.9 here) is not used for a wideband computation — the kernel takes the frequencies from the signal — but it remains a mandatory parameter of the task language. In multi-frequency mode the kernel does not compare it with FREQ.

The Tmin…Tmax window (30…40 ns here) is taken into account since 26.10.2026: only the samples inside the window are used for the frequency decomposition. Previously the multi-frequency processing ignored the window and took all samples of the .t file.

  • A line without a window — SMATRIX wg_wide_s; 3.9; — means the full window 0…Tmax of the task. This is the default variant for multi-frequency mode; it gives exactly the same result as the former processing that ignored the window.
  • If a window was specified in an old task file (for example, 30; 40 with TIME 0.; 40;), it now takes effect, and the result may change. To get the former result, remove the window.
  • Warning about an undecayed response. If the pulse response has not decayed by the end of the window (in the last 5 % of the window the level is above 1 % of the peak) or the window starts while the incident pulse is still running, the kernel issues a warning to the console and the status bar, for example the response has not died away by the end of the window … 4.5 % of its peak or the window starts while the pulse is running …. The S-matrix is written in this case; check the window and the computation time TIME. After the end of the computation the warning text remains in the status bar, and to the left of it is the yellow label Done, with warnings.
Kernel status bar: warning about an undecayed response
Kernel status bar: warning about an undecayed response

Figure 3. Kernel status bar after a multi-frequency computation with too short a SMATRIX window: the response has not decayed by the end of the window (4.5 % of the peak).

Multitone fitting interval (the author's answer of 29.10.2026). For a continuous multitone the harmonic fitting interval is exactly the window specified in the SMATRIX line; if the whole window is specified, the fitting is done over the whole window. The interval is not selected automatically.

The window in TPL Designer. The window is specified in the Output section, the Scattering matrix (TMCGROUT) group. If the task has an excited port with a signal file, the group shows the check box Limit the window (port with a signal file):

  • cleared (by default) — the program writes the line without a window, SMATRIX name; F; (the full window 0…TIME); the Recording window from: / to: fields are unavailable;
  • selected — the window from the Recording window from: / to: fields is written.

A window that ends later than TIME is treated as an error by the TPL Designer check (the file would be empty). For details — tpl_designer.md, Section 9.

4.2. Later, in TMCROS: "To S-matrix"

If the task had no SMATRIX, open the resulting .t in TMCROS and run the command Edit → To S-matrix. TMCROS itself sees the wideband computation flag in the .t header and builds the S-matrix at once on the whole frequency grid. TMCROS also takes the Tmin…Tmax window of this dialog into account, and shows the warning about an undecayed response in a message box.

TMCROS message about an undecayed response
TMCROS message about an undecayed response

Figure 4. TMCROS message after To S-matrix for a wideband .t with a short window: the S-matrix has been written, but the response has not decayed by the end of the window.

The Time signal export to S-matrix window
The Time signal export to S-matrix window

Figure 5. The TMCROS window Time signal export to S-matrix (the screenshot shows an ordinary single-frequency file poly.t). For details on the window elements — TMCROS.

4.3. Correction for port mismatch

A port with metal walls (H₁₀ wave) is matched by the kernel at one frequency — FREQ. At the other frequencies of the band it reflects slightly: without correction, in the wg_wide example this gave 0.81 dB and 11.06°, and the |S11| background of an empty channel was about −14 dB. Both programs (the kernel with SMATRIX and TMCROS) automatically remove this mismatch using the formula for renormalizing the port admittance; the port parameters (grid step, aperture, FREQ) are taken from the .t header, nothing is asked of the user. After the correction the deviation from the sweep is 0.0016 dB and 0.01°.

For a port with magnetic walls (MAGNETIC, plane wave) there is no mismatch: the admittance of such a port does not depend on frequency.

Limitation (clarified by the author on 29.10.2026). The port correction in multi-frequency mode is designed for identical ports and a symmetric device: the Gamma value of the excited port is applied to both ports. For ports of different widths or an asymmetric device the correction is inaccurate — for an exact result a frequency sweep is needed. A multi-channel port (frequency multiplexer) and multi-channel excitation are planned for the future.

TPL Designer reminds about this when checking the task: if, with a port fed from a signal file, the ports have different widths or different modes, the warning "wideband computation: ports '…' (… mm) and '…' (… mm) differ…" appears (tpl_designer.md, Section 9).

4.4. What the kernel writes to the .t

The kernel adds the following lines to the header of the signal file of a wideband computation:

#TMC_GROTS_Wideband 1
#TMC_GROTS_Port 7 0.001 0.06 3900000000 1
#TMC_GROTS_Port 12 0.001 0.06 3900000000 0

The first is the wideband computation flag. The others are one line per port: the block number, the grid step (m), the aperture (m), the matching frequency (Hz) and the "signal from file" flag (1 — yes, 0 — no). The list of frequencies (in hertz) is also transferred to the header from the #FREQ of the .sig file. Earlier versions of the programs skip these lines — the format has remained compatible.


5. Multi-frequency radiation pattern

5.1. How to specify it

If a port is excited by a .sig file with several frequencies and #OUTPUT contains a FIELD_DISTRIBUTION_M line, the kernel builds the radiation pattern at each frequency and writes a separate file for each:

<name>_<frequency in MHz>MHz.DAT

Example (dn_mf.tpl, the same waveguide, the wg_multi.sig signal of 10 tones 3.0–4.8 GHz):

#OUTPUT
 FILE dn_mf;
 FIELD_DISTRIBUTION_M dn_mf; 3.9; 30; 35;
#END_OUTPUT

The result is ten files dn_mf_3000MHz.DAT … dn_mf_4800MHz.DAT. The last two parameters of the line (30 and 35 ns here) are the time window over which the field distribution is accumulated.

Rules:

  • it must be the FIELD_DISTRIBUTION_M line. With FIELD_DISTRIBUTION (without _M) and a multi-frequency signal the kernel stops the computation with the error "needs FIELD_DISTRIBUTION_M";
  • the kernel rounds the length of the accumulation window up to a whole number of periods. If the number of periods is already whole, no extra period is added (since 26.10.2026; previously one more period was added, and the window could go beyond the end of the computation TIME);
  • the accumulation window must end before the end of the computation TIME (taking the rounding into account). A window ending exactly at TIME is not closed: there are no RP files, and the kernel reports an error (code 2). If the window goes beyond TIME, the kernel issues the computation error "Directional pattern window ends … after the calculation time" (figure below);
  • it is better to make the length of the accumulation window a multiple of 1/Δf, where Δf is the frequency spacing in the signal (for tones 0.2 GHz apart — 5 ns). Otherwise neighbouring frequencies "leak" into each other: with a 6 ns window the deviation from a separate single-frequency computation was 3.3 %, with a 5 ns window — 0.9 %.
Kernel status bar: the RP window ends after the computation time
Kernel status bar: the RP window ends after the computation time

Figure 6. The RP window (2.5…3.5 ns) ends after the end of the computation (TIME = 3 ns): there are no RP files, Done with errors, exit code 2.

5.2. RP on the region boundary only

The radiation pattern is built from the field on a contour around the radiating structure. Therefore the kernel can store the data for it not over the whole grid but only in four narrow strips along the edges of the region. This saves memory: for example, on a grid of 11 billion nodes — of the order of 48 MB instead of 176 GB.

The kernel turns on the "boundary" mode by itself:

Case What is stored
one frequency, an ordinary task the whole region (as before)
one frequency, the RP data would take more than a quarter of the free main memory the boundaries only
a multi-frequency signal (any size) the boundaries only, at each frequency

In the "boundary" mode the .AMP/.FAZ files (the field distribution over the whole region) are not written — only .DAT is written. The .DAT files are exactly the same: on test tasks of 200 × 200 and 1000 × 1000 nodes they matched the computation over the whole region number for number.

5.3. How to view it

Each .DAT file is opened in TMC_DN (File → Open...). To compare the patterns of different frequencies in one window, add files with the command Edit → Add characteristics (Ctrl+A). For details — TMC_DN.

TMC_DN main window
TMC_DN main window

Figure 7. TMC_DN main window (the screenshot shows the example r7.DAT, a single-frequency RP, 10 GHz).


6. Where to view the result

What Program File
signals at the ports (the incident wave from the file and the responses) TMCROS .t
S-matrix at all frequencies TMCGROUT .s
radiation patterns by frequency TMC_DN <name>_<MHz>MHz.DAT

In TMCGROUT the frequency response looks the same as after a sweep: frequency along the X axis, the selected quantity along the Y axis (|S|, phase, VSWR, etc.).

TMCGROUT main window with a frequency response
TMCGROUT main window with a frequency response

Figure 8. TMCGROUT with the file f_diel_sweep.s (a waveguide with an ε = 2 insert, 10 frequencies 3.0–4.8 GHz, VSWR along the Y axis). This file was obtained the old way — by a 10-step sweep; a multi-frequency pass of the same task (f_diel_wide.tpl) gives a .s at the same frequencies.


7. Limitations and specifics

  • The .s is appended to, not overwritten. In one wideband pass all frequencies of the band are added to the .s at once. Before computing again, the .s file must be deleted (manually or with the Delete button in the TMCROS Time signal export to S-matrix window — it deletes the file without asking). If an existing .s cannot be read, the kernel does not silently replace it but reports an error.
  • No more than 99 frequencies in one .s. With more frequencies the kernel reports an error writing the .s (exit code 2 in batch mode).
  • Comparison with a sweep is possible only at the frequencies from the list of tones. At a frequency that is not in the signal there is nothing to compare.
  • An error at one frequency does not abort the processing (since 26.10.2026). At frequencies with an error (for example, at a frequency below the cutoff frequency of the port — the error "Frequency … is below cutoff of port") zeros are written to the .s, the other frequencies are computed; at the end of the computation the exit code is 2. Previously the processing stopped at the first bad frequency, and the .s was not created.
  • An S that is not a number (NaN or Inf — for example, with a diverging field) is an error, not a NaN in the .s file.
  • Bandwidth. The multimode regime (a band above the second cutoff frequency of the port, the H₂₀ wave) has not been investigated — keep the band within the single-mode range of the port. TPL Designer shows this range when setting up the port.
  • The port mismatch correction is designed for identical ports and a symmetric device (Sec. 4.3); for ports of different widths or an asymmetric device it is inaccurate — a frequency sweep is needed. It has not been checked separately on lossy structures.
  • The step of the .sig file must be finer than the kernel time step (Sec. 2.3).

8. Step by step: a sweep in one pass

  1. Create a .sig incident-wave file in TPL Designer (Sec. 2.4) with the required band and number of tones, or take the ready-made samples/MULTIFREQ/wg_multi.sig.
  2. Put the .sig in the same folder as the .tpl task file.
  3. In the task file, write the file name in brackets in place of Amp for the exciting port: [wg_multi].
  4. Set FREQ to the centre of the band.
  5. Leave one #STEP; add SMATRIX to #OUTPUT (Sec. 4.1). For the full window, write the line without a window (SMATRIX name; F;; in TPL Designer, leave the Limit the window (port with a signal file) check box cleared for this). Remove the FIELDS; and TOPOLOGY; lines for speed.
  6. Delete the old .s with the same name, if there is one.
  7. Open the task file in the kernel and start the computation (Run → Run, F5).
  8. Check the status bar: whether there is a warning about an undecayed response or error messages at some frequencies.
  9. Open the resulting .s in TMCGROUT (the View S-matrix button on the kernel toolbar).