Engee documentation

EngeePhased.PhaseCodedWaveform

A phase-code modulated signal generator.

Library

EngeePhased

Block

Phase-Coded Waveform

Description

To generate a phase-code modulated (FCM) signal, follow these steps:

  1. Create an object EngeePhased.PhaseCodedWaveform 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.PhaseCodedWaveform() — creates a system object waveform a signal generator with FCM with default properties.

  • waveform = EngeePhased.PhaseCodedWaveform(Name=Value) — creates a system object waveform a FCM signal generator 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 pulse counts from the FCM in the form of a column vector 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 the 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".

  • 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 must 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

+ column vector

Details

The output signal returned as a complex column vector.

Типы данных

Float64

Support for complex numbers

yes

prf — pulse repetition rate, Hz

+ scalar

Details

The current pulse repetition rate, returned as a scalar.

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

Details

Coefficients of the matched filter, returned as a complex vector of size , where — the largest non-zero pulse width.

Dependencies

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

Типы данных

Float64

Support for complex numbers

yes

Features

# Code — type of phase code
String

Details

Specify the type of phase code used in phase modulation. Acceptable values:

  • "Frank" (by default);

  • "P1";

  • "P2";

  • "Px";

  • "Zadoff-Chu";

  • "P3";

  • "P4";

  • "Barker".

# OutputFormat — output signal format
String

Details

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

  • If you set the value for this property "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 the value for this property "Samples", then the output of the block consists of several samples. The number of samples is the value of the [Property:numSamples] property.

# 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".

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

# 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 period (PRI) is the inverse of the pulse repetition rate (PRF). The PRF value must satisfy the following constraints:

  • The product of PRF and the pulse duration 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 the property values combined 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.

# SequenceIndex — the index of the Zadov — Chu sequence
Integer

Details

Specify the sequence index used in the code "Zadoff-Chu", as a positive integer.

The value of the SequenceIndex property must be one-to-one with the value of the NumChips property.

Dependencies

To use this property, set the Code value "Zadoff-Chu".

# ChipWidth — the duration of each chip
Real number

Details

Specify the duration of each chip in the FCM signal as a positive scalar. For a given signal, the pulse duration is equal to the product of the chip duration and the number of chips.

The value of this property must satisfy the following constraints:

  • ChipWidth is less than or equal to (1/(NumChips * PRF)) — the total duration of all chips cannot exceed the pulse duration.

  • SampleRate * ChipWidth is an integer — the number of samples in a chip must be an integer.

The units of measurement are seconds.

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

# SampleRate — sampling rate
Real number

Details

The sampling frequency of the signal, set as a positive scalar. The value of this property must satisfy the following constraints:

  • SampleRate/PRF is a scalar or vector containing only integers — the number of samples per pulse must be an integer.

  • SampleRate * ChipWidth is an integer — the number of samples in the chip must be an integer.

The units of measurement are Hz.

Default value — 1e6.

# NumChips — code length
Real number

Details

Specify the number of chips per pulse in the FCM signal as a positive integer. The value of this property must be less than or equal to (1/(NumChips * PRF)) — the total duration of all chips cannot exceed the pulse repetition interval.

Default value — 4.

The table shows additional limits on the number of chips for different types of code.

NumChips

"Frank", "P1", "Px"

The square of a prime number

"P2"

An even number that is the square of a prime number

"Barker"

2, 3, 4, 5, 7, 11 or 13

# PRFOutputPort — enable PRF output
Logical

Details

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 (by default), the object will use the PRF property to define the PRF sequence used in the simulation.

Dependencies

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

# 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

Formation of the FCM signal

Details

We will generate an FCM signal with a Barker code of length 13, the duration of the chip 20 mks, pulse repetition rate 20 kHz and the central frequency 50 kHz.

Initialize the parameters.

fs = 1e6 # Частота дискретизации, Гц
type_code = "Barker" # тип кода ["Frank","Barker","Zadoff-Chu"]
ch_w = 2.0e-5 # длительность чипа
n_chip = 13 # количество чипов в импульсе
prf = 2000 # частота следования импульсов (ЧСИ)

freq_off_type = "Property" # способ задания параметров "Property" — в параметрах СО
freq_off = 50_000 # значение начальной частоты спектра, Гц
out_type = "Pulses" # тип выходного сигнала "Pulses" — по импульсам
num_pulse = 1; # количество импульсов

Let’s use EngeePhased.PhaseCodedWaveform to create a probe signal system object PCM_Waveform.

PCM_Waveform = EngeePhased.PhaseCodedWaveform(
    SampleRate = fs, # частота дискретизации
    Code = type_code, # тип кода
    ChipWidth = ch_w, # длительность чипа
    NumChips = n_chip, # количество чипов
    PRF = prf, # частота следования чипа
    FrequencyOffsetSource = freq_off_type,
    FrequencyOffset = freq_off,
    OutputFormat = out_type,
    NumPulses = num_pulse,
);

Making a call to the system object EngeePhased.PhaseCodedWaveform using the pcm_signal variable.

pcm_signal = PCM_Waveform();

Using the function plot Let’s construct 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(pcm_signal)) * 1e6 # сетка времени, мкс
fig1 = plot(t_grid,real.(pcm_signal),title = "синфазная составляющая",lab="",ylab="Амплитуда")
fig2 = plot(t_grid,imag.(pcm_signal),title = "квадратурная составляющая",lab="",xlab = "Время, мкс",ylab="Амплитуда");

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

object phased phase coded waveform 2 en

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

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

object phased phase coded waveform 3 en

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

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

Visualize the result using the function plot.

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

object phased phase coded waveform 4 en

To calculate the spectrogram, we use the built-in function spectrogram.

# расчет спектрограммы
spectgm_pcm,f1,t1 = EngeeDSP.Functions.spectrogram(
    pcm_signal;
    nfft = 1024, # длина БПФ
    window = 128,
    noverlap = 120, # перекрытие окна
    spectrumtype = "power",  # тип спектра — по мощности
    freqrange = "twosided", # диапазон спектра — двусторонний
    out = :data, # тип выхода — массив данных
    fs = fs # частота дискретизации
);

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

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

object phased phase coded waveform 5 en

Additional Info

In the two-chip Barker code, you can use [1 −1] or [1 1] as a sequence of amplitudes. Implemented in this system object [1 −1].

In the four-chip Barker code, you can use [1 1 −1 1] or [1 1 1 −1] as a sequence of amplitudes. Implemented in this system object [1 1 −1 1].

In the Task code, you can use a sequence of phases clockwise or counterclockwise. This system object implements a counterclockwise sequence, for example, π⋅f(k)⋅SequenceIndex/NumChips Instead of −π⋅f(k)⋅SequenceIndex/NumChips. In these terms k — the chip’s index, and f(k) — a function of k.

For more information, see [1].

Algorithms

The FKM radio pulse can be written as

where

  •  — the duration of one elementary secret (chip);

  •  — elements of the code sequence (for example, Barker codes or M-sequences) that take the values ±1;

  •  — the length of the code.

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

  • filter sampling rate ;

  • pulse duration ;

  • pulse repetition rate ;

  • number of pulses ;

  • the initial frequency of the signal ;

  • the final frequency of the signal ;

  • frequency deviation .

object phased phase coded waveform 1 en

Literature

  1. Levanon, N. and E. Mozeson. Radar Signals. Hoboken, NJ: John Wiley & Sons, 2004.