Radar Model#
Radar Configuration and Phase Noise Modeling in Python
This module contains classes and functions to define and simulate the parameters and behavior of radar systems. It includes tools for configuring radar system properties, modeling oscillator phase noise, and simulating radar motion and noise characteristics. A major focus of the module is on accurately modeling radar signal properties, including phase noise and noise amplitudes.
—
Copyright (C) 2018 - PRESENT radarsimx.com
E-mail: info@radarsimx.com
Website: https://radarsimx.com
██████╗ █████╗ ██████╗ █████╗ ██████╗ ███████╗██╗███╗ ███╗██╗ ██╗
██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██║████╗ ████║╚██╗██╔╝
██████╔╝███████║██║ ██║███████║██████╔╝███████╗██║██╔████╔██║ ╚███╔╝
██╔══██╗██╔══██║██║ ██║██╔══██║██╔══██╗╚════██║██║██║╚██╔╝██║ ██╔██╗
██║ ██║██║ ██║██████╔╝██║ ██║██║ ██║███████║██║██║ ╚═╝ ██║██╔╝ ██╗
╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
radarsimpy.Transmitter#
- class radarsimpy.Transmitter(f, t, tx_power=0, pulses=1, prp=None, f_offset=None, pn_f=None, pn_power=None, channels=None)[source]#
Bases:
objectDefines the basic parameters and properties of a radar transmitter.
This class handles the waveform configuration, pulse parameters, and properties of the transmitter channels.
- Parameters:
f (float or numpy.ndarray) –
Waveform frequency in Hertz (Hz). The value can be:
A single number: For a single-tone waveform.
A list
[f_start, f_stop]: For linear frequency modulation.A 1D array: For arbitrary waveforms, which must be paired with
tfor timing.
t (float or numpy.ndarray) – Timing of the pulse(s) in seconds (s). Used when
fis a 1D array to specify an arbitrary waveform.tx_power (float) – Transmitter power in decibels-milliwatts (dBm).
pulses (int) – Total number of pulses.
prp (float or numpy.ndarray) –
Pulse repetition period (PRP) in seconds (s). Must satisfy
prp >= pulse_length.If
prpisNone, it defaults topulse_length.Can also be a 1D array to specify different PRPs for each pulse. In this case, the array length must match
pulses.
f_offset (numpy.ndarray) – Frequency offset for each pulse in Hertz (Hz). Length must match
pulses. Default:None(no offset).pn_f (numpy.ndarray) – Frequencies associated with phase noise in Hertz (Hz). Must be paired with
pn_power. Default:None.pn_power (numpy.ndarray) – Power spectral density of phase noise in dB/Hz. Must be paired with
pn_f. Default:None.channels (list[dict]) –
Properties of transmitter channels. Each channel is represented as a dictionary with the following keys:
location (numpy.ndarray): 3D location of the channel relative to the radar [x, y, z] in meters.
polarization (numpy.ndarray): Antenna polarization vector [x, y, z]. Default:
[0, 0, 1](vertical polarization). Examples:Vertical polarization:
[0, 0, 1]Horizontal polarization:
[0, 1, 0]Right-handed circular polarization:
[0, 1, 1j]Left-handed circular polarization:
[0, 1, -1j]
delay (float): Transmit delay (s). Default:
0.azimuth_angle (numpy.ndarray): Azimuth angles in degrees (°). Default:
[-90, 90].azimuth_pattern (numpy.ndarray): Azimuth pattern in decibels (dB). Default:
[0, 0].elevation_angle (numpy.ndarray): Elevation angles in degrees (°). Default:
[-90, 90].elevation_pattern (numpy.ndarray): Elevation pattern in decibels (dB). Default:
[0, 0].grid (float): The grid size in degrees (°) used to initially check the occupancy of a scene. Default:
1.pulse_amp (numpy.ndarray): Relative amplitude sequence for pulse amplitude modulation. Length must match
pulses. Default:1.pulse_phs (numpy.ndarray): Phase code sequence for pulse phase modulation in degrees (°). Length must match
pulses. Default:0.mod_t (numpy.ndarray): Timestamps for waveform modulation in seconds (s). Default:
None.phs (numpy.ndarray): Phase modulation scheme in degrees (°). Default:
None.amp (numpy.ndarray): Relative amplitude scheme for waveform modulation. Default:
None.
- Variables:
rf_prop (dict) –
RF properties of the transmitter:
tx_power (float): Transmitter power in dBm.
pn_f (numpy.ndarray): Frequencies associated with phase noise (Hz).
pn_power (numpy.ndarray): Power of phase noise (dB/Hz).
waveform_prop (dict) –
Waveform properties:
f (float or numpy.ndarray): Waveform frequency (Hz).
t (float or numpy.ndarray): Timing of each pulse (s).
bandwidth (float): Transmitting bandwidth (Hz).
pulse_length (float): Duration of each pulse (s).
pulses (int): Total number of pulses.
f_offset (numpy.ndarray): Frequency offset for each pulse (Hz).
prp (float or numpy.ndarray): Pulse repetition period (s).
pulse_start_time (numpy.ndarray): Start times of each pulse (s).
txchannel_prop (dict) –
Properties of the transmitter channels:
size (int): Number of transmitter channels.
delay (numpy.ndarray): Transmitter start delay (s).
grid (float): Ray tracing grid size (°).
locations (numpy.ndarray): 3D locations of the transmitter channels [x, y, z] in meters.
polarization (numpy.ndarray): Polarization vectors of the transmitter channels.
waveform_mod (dict): Waveform modulation parameters.
pulse_mod (dict): Pulse modulation parameters.
az_angles (numpy.ndarray): Azimuth angles (°).
az_patterns (numpy.ndarray): Azimuth patterns (dB).
el_angles (numpy.ndarray): Elevation angles (°).
el_patterns (numpy.ndarray): Elevation patterns (dB).
antenna_gains (numpy.ndarray): Transmitter antenna gains (dB).
Usage Examples:
Basic single-channel transmitter:
>>> tx = Transmitter(f=24.125e9, t=1e-6)
Multi-channel transmitter with custom polarization:
>>> channels = [ ... {"location": [0, 0, 0], "polarization": [0, 0, 1]}, # Vertical ... {"location": [0.1, 0, 0], "polarization": [0, 1, 0]} # Horizontal ... ] >>> tx = Transmitter(f=[24e9, 24.5e9], t=[0, 1e-6], channels=channels)
FMCW radar transmitter:
>>> tx = Transmitter( ... f=[77e9, 81e9], # 4 GHz sweep ... t=[0, 100e-6], # 100 μs chirp ... pulses=128, ... prp=200e-6 # 200 μs PRP ... )
Waveform Schematic:
Illustration of the waveform, pulse repetition period, and modulation:
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ prp █ █ +-----------+ █ █ +---f[1]---------> / / / █ █ / / / █ █ / / / █ █ / / / █ █ / / / ... █ █ / / / █ █ / / / █ █ / / / █ █ +---f[0]--->/ / / █ █ +-------+ █ █ t[0] t[1] █ █ █ █ Pulse +--------------------------------------+ █ █ modulation |pulse_amp[0]|pulse_amp[1]|pulse_amp[2]| ... █ █ |pulse_phs[0]|pulse_phs[1]|pulse_phs[2]| ... █ █ +--------------------------------------+ █ █ █ █ Waveform +--------------------------------------+ █ █ modulation | amp / phs / mod_t | ... █ █ +--------------------------------------+ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
- property bandwidth: float#
Get the transmitting bandwidth.
- property channel_locations: ndarray[tuple[Any, ...], dtype[_ScalarT]]#
Get the 3D locations of transmitter channels.
- property frequency: ndarray[tuple[Any, ...], dtype[_ScalarT]]#
Get the waveform frequency array.
- get_channel_info(channel_idx)[source]#
Get comprehensive information about a specific channel.
- Parameters:
channel_idx (int) – Index of the channel (0-based)
- Returns:
Dictionary containing channel information
- Return type:
dict
- Raises:
IndexError – If channel_idx is out of range
- property num_channels: int#
Get the number of transmitter channels.
- property num_pulses: int#
Get the total number of pulses.
- property pulse_length: float#
Get the duration of each pulse.
radarsimpy.Receiver#
- class radarsimpy.Receiver(fs, noise_figure=10, rf_gain=0, load_resistor=500, baseband_gain=0, bb_type='complex', channels=None)[source]#
Bases:
objectRepresents the basic parameters and properties of a radar receiver.
This class defines the RF and baseband properties of a radar receiver, along with the characteristics of its receiver channels.
- Parameters:
fs (float) – Sampling rate in samples per second (sps).
noise_figure (float) – Noise figure of the receiver in decibels (dB).
rf_gain (float) – Total RF gain of the receiver in decibels (dB).
load_resistor (float) – Load resistance to convert power to voltage, in ohms (Ω).
baseband_gain (float) – Total baseband gain in decibels (dB).
bb_type (str) – Baseband data type, either
complexorreal. Defaults tocomplex.channels (list[dict]) –
A list of dictionaries defining the properties of receiver channels, where each dictionary contains the following keys:
location (numpy.ndarray): 3D location of the channel relative to the radar’s position [x, y, z] in meters.
polarization (numpy.ndarray): Antenna polarization vector [x, y, z]. Defaults to
[0, 0, 1](vertical polarization). Examples:Vertical polarization:
[0, 0, 1]Horizontal polarization:
[0, 1, 0]Right-handed circular polarization:
[0, 1, 1j]Left-handed circular polarization:
[0, 1, -1j]
azimuth_angle (numpy.ndarray): Azimuth pattern angles in degrees. Defaults to
[-90, 90].azimuth_pattern (numpy.ndarray): Azimuth pattern in decibels (dB). Defaults to
[0, 0].elevation_angle (numpy.ndarray): Elevation pattern angles in degrees. Defaults to
[-90, 90].elevation_pattern (numpy.ndarray): Elevation pattern in decibels (dB). Defaults to
[0, 0].
- Variables:
rf_prop (dict) –
RF properties of the receiver:
rf_gain (float): RF gain in decibels (dB).
noise_figure (float): Noise figure in decibels (dB).
bb_prop (dict) –
Baseband properties of the receiver:
fs (float): Sampling rate in samples per second (sps).
load_resistor (float): Load resistance in ohms (Ω).
baseband_gain (float): Baseband gain in decibels (dB).
bb_type (str): Baseband data type, either
realorcomplex.
rxchannel_prop (dict) –
Properties of the receiver channels:
size (int): Number of receiver channels.
locations (numpy.ndarray): 3D locations of the receiver channels [x, y, z] in meters.
polarization (numpy.ndarray): Polarization vectors of the receiver channels.
az_angles (numpy.ndarray): Azimuth angles in degrees.
az_patterns (numpy.ndarray): Azimuth pattern in decibels (dB).
el_angles (numpy.ndarray): Elevation angles in degrees.
el_patterns (numpy.ndarray): Elevation pattern in decibels (dB).
antenna_gains (numpy.ndarray): Antenna gains of the receiver channels in decibels (dB).
Receiver Noise Model:
The following diagram illustrates the radar receiver noise model and calculations:
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ +-------------+ █ █ | Rx Antenna | █ █ +------+------+ █ █ | n1 = 10*log10(boltzmann_const * noise_temp * 1000) █ █ ↓ + 10*log10(noise_bandwidth) (dBm) █ █ +------+------+ █ █ | RF Amp | █ █ +------+------+ █ █ | n2 = n1 + noise_figure + rf_gain (dBm) █ █ ↓ n3 = 1e-3 * 10^(n2/10) (Watts) █ █ +------+------+ █ █ | Mixer | █ █ +------+------+ █ █ | n4 = sqrt(n3 * load_resistor) (V) █ █ ↓ █ █ +------+------+ █ █ |Baseband Amp | █ █ +------+------+ █ █ | noise amplitude (peak to peak) █ █ ↓ n5 = n4 * 10^(baseband_gain / 20) * sqrt(2) (V) █ █ +------+------+ █ █ | ADC | █ █ +-------------+ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
- property channel_locations: ndarray[tuple[Any, ...], dtype[_ScalarT]]#
Get the 3D locations of receiver channels.
- get_channel_info(channel_idx)[source]#
Get comprehensive information about a specific channel.
- Parameters:
channel_idx (int) – Index of the channel (0-based)
- Returns:
Dictionary containing channel information
- Return type:
dict
- Raises:
IndexError – If channel_idx is out of range
- property noise_bandwidth: float#
Get the noise bandwidth.
- property num_channels: int#
Get the number of receiver channels.
- property sampling_rate: float#
Get the sampling rate.
radarsimpy.Radar#
- class radarsimpy.Radar(transmitter, receiver, frame_time=0, location=(0, 0, 0), speed=(0, 0, 0), rotation=(0, 0, 0), rotation_rate=(0, 0, 0), seed=None, **kwargs)[source]#
Bases:
objectDefines the basic parameters and properties of a radar system.
This class represents the overall configuration of a radar system, including its transmitter, receiver, spatial properties (location, speed, orientation), and associated metadata.
- Parameters:
transmitter (Transmitter) – The radar transmitter instance.
receiver (Receiver) – The radar receiver instance.
frame_time (float, int, list, tuple, or numpy.ndarray) – Frame start times for radar simulation. Can be a single value for one frame, or a sequence of values for multiple frames. Specified in seconds. Default:
0.location (list) – The 3D location of the radar relative to a global coordinate system [x, y, z] in meters (m). Default:
[0, 0, 0].speed (list) – The velocity of the radar in meters per second (m/s), specified as [vx, vy, vz]. Default:
[0, 0, 0].rotation (list) – The radar’s orientation in degrees (°), specified as [yaw, pitch, roll]. Default:
[0, 0, 0].rotation_rate (list) – The radar’s angular velocity in degrees per second (°/s), specified as [yaw rate, pitch rate, roll rate]. Default:
[0, 0, 0].seed (int) – Seed for the random noise generator to ensure reproducibility.
Note
For time-varying motion (location/rotation changes over time), initialize the Radar object first with the desired frame_time, then use the
set_motion()method to configure time-varying motions usingradar.time_prop["timestamp"]as the time variable. See the documentation ofset_motion()for detailed workflow and examples.- Variables:
time_prop (dict) –
Time-related properties of the radar system:
timestamp_shape (tuple): The shape of the timestamp array.
timestamp (numpy.ndarray): The timestamp for each sample in a frame, structured as
[channels, pulses, samples]. Channel order in timestamp (withMTx channels andNRx channels):[0, :, :]
Tx[0] → Rx[0][1, :, :]
Tx[0] → Rx[1]…
[N-1, :, :]
Tx[0] → Rx[N-1][N, :, :]
Tx[1] → Rx[0]…
[M·N-1, :, :]
Tx[M-1] → Rx[N-1]
sample_prop (dict) –
Sample-related properties:
samples_per_pulse (int): Number of samples in a single pulse.
noise (float): Noise amplitude.
phase_noise (numpy.ndarray): Phase noise matrix for pulse samples.
array_prop (dict) –
Metadata related to the radar’s virtual array:
size (int): Total number of virtual array elements.
virtual_array (numpy.ndarray): 3D locations of each virtual array element, structured as
[channel_size, 3]where each row corresponds to an [x, y, z] position.
radar_prop (dict) –
Radar system properties:
transmitter (Transmitter): Instance of the radar transmitter.
receiver (Receiver): Instance of the radar receiver.
location (list): The radar’s 3D location in meters (m).
speed (list): The radar’s velocity in meters per second (m/s).
rotation (list): The radar’s orientation in radians (rad).
rotation_rate (list): Angular velocity of the radar in radians per second (rad/s).
- Parameters:
transmitter (Transmitter)
receiver (Receiver)
frame_time (float | int | List[float | int] | Tuple[float | int, ...] | ndarray[tuple[Any, ...], dtype[_ScalarT]])
location (Tuple[float, float, float] | List[float])
speed (Tuple[float, float, float] | List[float])
rotation (Tuple[float, float, float] | List[float])
rotation_rate (Tuple[float, float, float] | List[float])
seed (int | None)
- property num_channels: int#
Get the total number of virtual array channels.
- property receiver#
Get the receiver instance.
- property samples_per_pulse: int#
Get the number of samples per pulse.
- set_motion(location=(0, 0, 0), speed=(0, 0, 0), rotation=(0, 0, 0), rotation_rate=(0, 0, 0))[source]#
Set the motion parameters for the radar.
This method allows updating radar motion after initialization. For time-varying motions, follow this workflow:
Initialize the Radar object first with desired frame_time:
radar = Radar(transmitter, receiver, frame_time=[0, 1e-3, 2e-3])Use radar.time_prop[“timestamp”] as the time variable for motion calculations:
location_x = 10 * np.sin(2 * np.pi * radar.time_prop["timestamp"])Call set_motion() to update time-varying motions:
radar.set_motion(location=[location_x, 0, 0], speed=[0, 0, 0])
Note: For time-varying motions, speed and rotation_rate must be [0, 0, 0] since motion is specified directly through time-varying location/rotation arrays.
- Parameters:
location (list) – The 3D location of the radar relative to a global coordinate system [x, y, z] in meters (m). For time-varying motion, provide arrays with shape matching
radar.time_prop["timestamp"]. Default:[0, 0, 0].speed (list) – The velocity of the radar in meters per second (m/s), specified as [vx, vy, vz]. Must be [0, 0, 0] when using time-varying location arrays. Default:
[0, 0, 0].rotation (list) – The radar’s orientation in degrees (°), specified as [yaw, pitch, roll]. For time-varying motion, provide arrays with shape matching
radar.time_prop["timestamp"]. Default:[0, 0, 0].rotation_rate (list) – The radar’s angular velocity in degrees per second (°/s), specified as [yaw rate, pitch rate, roll rate]. Must be [0, 0, 0] when using time-varying rotation arrays. Default:
[0, 0, 0].
- Return type:
None
- property transmitter#
Get the transmitter instance.
- property virtual_array_locations: ndarray[tuple[Any, ...], dtype[_ScalarT]]#
Get the 3D locations of virtual array elements.