Engee documentation

EngeePhased.RectangularWaveform

A rectangular pulse generator.

Library

EngeePhased

Block

Rectangular Waveform

Description

To generate a pulse signal with a preset pulse duration and pulse repetition rate (PRF), follow these steps:

  1. Create an object EngeePhased.RectangularWaveform and set its properties.

  2. Call the object with arguments as if it were a function.

To learn more about how to work with system objects, see Engee System Objects.

Syntax

Creation

  • waveform = EngeePhased.RectangularWaveform() — creates a rectangular pulse generator system object waveform with default properties.

  • waveform = EngeePhased.RectangularWaveform(Name=Value) — creates a rectangular pulse generator system object waveform with the specified property Name, set to the specified value Value. You can specify additional properties as name-value pairs in any order (Name1=Value1,…​,NameN=ValueN).

Using

  • Y = waveform() — returns a rectangular pulse signal Y.

  • Y = waveform(prfidx) — uses the prfidx index to select the pulse repetition rate (PRF) from a predefined vector of values set by the PRF property. This syntax applies if the PRFOutputPort property is set to true.

  • Y = waveform(freqoffset) — uses freqoffset to generate a frequency offset signal. Use this syntax in cases where it is necessary to dynamically update the frequency of transmitted pulses. This syntax applies if for a property FrequencyOffsetSource value set "Input port".

  • Y,PRF = waveform(_) — also returns the current pulse repetition rate PRF. To use this syntax, set the PRFOutputPort property to true, and for the property OutputFormat value "Pulses". PRF returns the current pulse repetition rate used by the system.

  • Y,COEFF = waveform(_) — also returns the coefficients of the matched COEFF filter for the current pulse. To use this syntax, set the [Property:CoordicientsOutputPort] value true.

You can combine optional input and output arguments if properties are specified that include them. Optional inputs and outputs should be listed in the same order as the properties that include them. For example, Y,PRF,COEFF = waveform(prfidx,freqoffset).

Arguments

Input arguments

prfidx — pulse repetition rate index

+ a positive integer

Details

Pulse Repetition rate index (PRF), set as a positive integer. The index identifies entries in the PRF property. Use this argument in cases where the transmission pulse must be selected dynamically. In such situations, the PRF property contains a list of predefined PRF selection options. During the simulation, based on the input data prfidx, one of the PRFs is selected as the PRF for the next transmission.

Dependencies

To use this argument, set the PRFOutputPort property to true.

freqoffset — frequency offset, Hz

+ scalar

Details

The frequency offset specified as a scalar. The offset allows you to generate a signal with a frequency offset. Use this argument in cases where it is necessary to dynamically update the frequency of the transmitted pulse.

Dependencies

To use this argument, set the property to FrequencyOffsetSource value "Input port".

Типы данных

Float64

Output arguments

Y — pulse signal

+ the complex vector

Details

The output signal returned as a complex vector.

Типы данных

Float64

Support for complex numbers

yes

PRF — pulse repetition rate, Hz

+ scalar

Details

The pulse repetition rate returned as a scalar. PRF contains the current pulse repetition rate used by the system.

Dependencies

To use this argument, set the PRFOutputPort property to true, and for the property OutputFormat value "Pulses".

Типы данных

Float64

Support for complex numbers

yes

COEFF — coefficients of the matched filter

+ vector | the matrix

Details

Coefficients of the matched filter returned as a complex vector of size or a complex matrix of size .

Dependencies

To use this argument, set the property to [Property:CoordicientsOutputPort] value true.

Типы данных

Float64

Support for complex numbers

yes

Features

# NumSamples — number of samples of the output signal
Real number

Details

The number of samples of the output signal, set as a positive integer.

Default value — 100.

Dependencies

To use this property, set the OutputFormat value "Samples".

# OutputFormat — output signal format
String

Details

The format of the output signal in the form "Pulses" (by default) or "Samples":

  • If you set this property to "Pulses", then the output of the block consists of several pulses. The number of pulses is the value of the property NumPulses.

  • If you set this property to "Samples", then the output of the block consists of several samples. The number of samples is the value of the [Property:numSamples] property.

# FrequencyOffsetSource — The source of the frequency offset setting
String

Details

The source of the frequency offset setting, set as "Property" (by default) or "Input port":

  • If the value is set to "Property", then the offset is determined by the value of the FrequencyOffset.

  • If the value is set to "Input port", the offset is determined by the value of the FreqOffset argument.

# DutyCycle — fill factor
Real number

Details

A dimensionless fill factor specified as a scalar in the range [0, 1]. The pulse width is the value of the DutyCycle property divided by the value of the PRF property. This value is dimensionless.

Default value — 0.5.

Dependencies

To use this property, set the DurationSpecification property to "Duty cycle".

# NumPulses — number of output signal pulses
Real number

Details

The number of pulses of the output signal, set as a positive integer.

Default value — 1.

Dependencies

To use this property, set the OutputFormat value "Pulses".

# PRF — pulse repetition rate
Real number

Details

Pulse repetition rate (PRF), set as a scalar or string vector. The units of measurement are Hz. The pulse repetition interval (PRI) is the inverse of the pulse repetition rate (PRF). The PRF value must satisfy the following constraints:

  • The product of PRF and PulseWidth must be less than or equal to one. This condition requires that the pulse width be less than one PRI. For a phase-coded signal, the pulse duration is equal to the product of the duration of one chip and the number of chips.

  • Relation SampleRate k PRF must be an integer. This condition requires that the number of samples in one PRI be an integer.

The PRF value can be set using only the PRF property values or using the property values in combination with the prfidx input argument.

  • If PRFOutputPort has a value false, PRF is set only using the PRF properties. You can:

    • Implement a constant PRF by specifying the PRF property as a positive real scalar value.

    • Implement a discrete PRF by specifying the PRF property as a vector string with positive real elements. Each object call uses consecutive elements of this vector as a PRF. As soon as the object reaches the last element of the vector, it cyclically continues the process with the first element of the vector.

  • When PRFOutputPort has a value true you can set the value of PRF using the PRF property in combination with the input argument prfidx. You implement a selectable PRF by specifying the PRF property as a vector string with positive real elements. When executing an object, the PRF is selected using the index specified in the input argument prfidx to index the PRF vector.

In all cases, the number of output samples is fixed if you set the property to OutputFormat value "Samples". When using a variable pulse repetition rate (PRF) and setting for the property OutputFormat values "Pulses" the number of counts may vary.

Default value — 10e3.

# CoefficientsOutputPort — enable output of matched filter coefficients
Logical

Details

Enable or disable the output of the coefficients of the matched filter by specifying the value false (by default) or true. Set this property to true to enable the output of matched filter coefficients for the waveform used during the simulation.

# PulseWidth — pulse duration
Real number

Details

The pulse duration, set as a positive scalar. The value must meet the condition PulseWidth < 1/PRF. The units of measurement are seconds.

Default value — 50e−6.

Dependencies

To use this property, set the DurationSpecification property to "Pulse width".

# SampleRate — sampling rate
Real number

Details

The sampling frequency of the signal, set as a positive scalar. The ratio of the sampling rate to the pulse repetition rate must be a positive integer, so the number of samples in each pulse must be an integer. The units of measurement are Hz.

Default value — 1e6.

# DurationSpecification — pulse duration setting method
String

Details

The method of setting the pulse duration in the form "Pulse width" (by default) or "Duty cycle":

  • "Pulse width" — the pulse duration is set using the PulseWidth property.

  • "Duty cycle" — the pulse duration is calculated from the values of the properties PRF and DutyCycle. The pulse width is equal to the value of the property DutyCycle divided by the value of the property PRF.

# PRFOutputPort — enable PRF output
Logical

Details

Enable the PRF selection input by specifying the value false (by default) or true. If you set the value for this property true. you can pass an index argument to an object to select a predefined value from a vector of property values PRF. If you set the value for this property false, the object will use the PRF property to define the PRF sequence used in the simulation.

# FrequencyOffset — frequency offset
Real number

Details

The frequency offset specified as a scalar. The units of measurement are Hz.

Default value — 0.

Dependencies

To use this property, set the FrequencyOffsetSource value "Property".

Methods

Common to all system objects

step!

Run the system object operation algorithm

release!

Allow changing the value of a system object property

reset!

Resetting the internal states of a system object

Special for system objects of signal generators

bandwidth

Bandwidth of the signal getMatchedFilter: Matched filter coefficients obtained from the signal

plot

Plotting the pulse signal

Examples

Rectangular shape signal generation

Details

Let’s form a rectangular signal with a sampling frequency 1 MHz, pulse duration 50 mks, the number of pulses per packet 5, the central frequency 200 kHz and pulse repetition rate 10 kHz.

Initialize the parameters.

fs = 1e6 # Частота дискретизации, Гц
dur_spec = "Pulse width" # Метод формирования длительности импульсов ["Pulse width", ""]
pw = 5.0e-5 # длительность импульса, с
prf = 10_000 # частота следования импульсов (ЧСИ)
freq_off_type = "Property" # способ задания частоты модуляции "Property" — в параметрах СО
freq_off = 200e3 # значение центральной частоты спектра, Гц
out_type = "Pulses" # тип выходного сигнала "Pulses" — по импульсам, Samples — по отсчетам
num_pulse = 5 # количество импульсов
prf_out = false # выключение выхода ЧСИ
coeff_mf_out = false; # выключение выхода коэффициентов СФ

Let’s use EngeePhased.RectangularWaveform to create a system object of the probing signal rect.

# Формирование системного объекта
rect = EngeePhased.RectangularWaveform(
    SampleRate = fs, # Частота дискретизации, Гц
    DurationSpecification = dur_spec, # Метод формирования длительности импульсов
    PulseWidth = pw, # длительность импульса, с
    PRF = prf, # частота следования импульсов
    FrequencyOffsetSource = freq_off_type,
    FrequencyOffset = freq_off, # центральная частота
    OutputFormat = out_type, # тип выходного сигнала
    NumPulses = num_pulse, # количество импульсов
    PRFOutputPort = prf_out,
    CoefficientsOutputPort = coeff_mf_out
);

Making a call to the system object EngeePhased.RectangularWaveform using the rect variable.

rect_sig = rect(); # генерация прямоугольного сигнала

Using the function plot Let’s build an oscilloscope in the form of an IQ component, a module, and a phase of the signal.

# построение IQ-компонент
t_grid = range(start = 0,step = 1/fs,length = length(rect_sig)) * 1e6 # сетка времени, мкс
fig1 = plot(t_grid,real.(rect_sig),title = "синфазная составляющая",lab="",ylab="Амплитуда")
fig2 = plot(t_grid,imag.(rect_sig),title = "квадратурная составляющая",lab="",xlab = "Время, мкс",ylab="Амплитуда");

plot(fig1,fig2,layout = (2,1))

object phased rectangular waveform 1 en

# построение модуля и фазы сигнала
fig3 = plot(t_grid,abs.(rect_sig),title = "Модуль комплексного сигнала",lab="",ylab="Амплитуда");
fig4 = plot(t_grid,angle.(rect_sig)*180/pi,title = "Аргумент комплексного сигнала",lab="",xlab = "Время, мкс",ylab="Фаза, град.");

plot(fig3,fig4,layout = (2,1))

object phased rectangular waveform 2 en

The main characteristic of the signal is the frequency spectrum and the spectrogram. Let’s use the built-in function periodogram.

# расчет спектра сигнала
spec,f = EngeePhased.Functions.periodogram(
    rect_sig, # исходный сигнал
    EngeeDSP.Functions.hamming(size(rect_sig)...),
    1024; # длина частоты дискретизации
    out = :data, # тип выхода
    fs = fs, # частота дискретизации
    spectrumtype = "power" # тип спектра
);

Visualize the result using the function plot.

plot(
    f * 1e-3,
    EngeePhased.Functions.mag2db.(spec),
    lab="", xlab = "Частота, кГц",
    ylab = "Мощность, дБВт",
    ylim = (-100,0),
    title = "Спектр сигнала"
)

object phased rectangular waveform 4 en

The spectrum has a needle-like structure, the components of which follow in steps. . To calculate the spectrogram, we use the built-in function spectrogram.

# расчет спектрограммы
spectgm1,f1,t1 = EngeeDSP.Functions.spectrogram(
    real.(rect_sig);
    nfft = length(rect_sig), # длина БПФ
    window = EngeeDSP.Functions.hamming(64),
    noverlap = 60, # перекрытие окна
    spectrumtype = "power",  # тип спектра — по мощности
    freqrange = "onesided", # диапазон спектра — односторонний
    out = :data, # тип выхода — массив данных
    fs = fs # частота дискретизации
);

We visualize the result of the spectrogram calculation using the function heatmap.

# построение спектрограммы
heatmap(
    t1[:]*1e6,f1[:]*1e-3,
    abs.(spectgm1),color = :jet,
    xlab = "Время, мкс",
    ylab = "Частота Доплера, кГц",
    ylims = (0,400)
)

object phased rectangular waveform 5 en

Algorithms

The analytical expression for a single complex radio pulse with a rectangular envelope has the form:

where

  •  — pulse duration;

  •  — signal amplitude;

  •  — initial (carrier) frequency;

  •  — defines a rectangular envelope:

  •  — the number of rectangular pulses in a sequence (bundles);

  •  — the repetition period, where  — pulse repetition rate.

To generate a rectangular signal, the following parameters must be set:

  • filter sampling rate ;

  • pulse duration ;

  • pulse repetition rate ;

  • number of pulses ;

  • the central frequency of the signal .

object phased rectangular waveform 3

Literature

  1. Richards, M. A. Fundamentals of Radar Signal Processing. New York: McGraw-Hill, 2005.