Simulator

The Python Module for Radar Simulation

This module provides advanced radar simulation capabilities, enabling users to simulate radar baseband responses for complex scenes. It supports point targets, 3D mesh objects, and offers features such as ray-tracing, interference modeling, and noise simulation.

██████╗  █████╗ ██████╗  █████╗ ██████╗ ███████╗██╗███╗   ███╗██╗  ██╗
██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██║████╗ ████║╚██╗██╔╝
██████╔╝███████║██║  ██║███████║██████╔╝███████╗██║██╔████╔██║ ╚███╔╝ 
██╔══██╗██╔══██║██║  ██║██╔══██║██╔══██╗╚════██║██║██║╚██╔╝██║ ██╔██╗ 
██║  ██║██║  ██║██████╔╝██║  ██║██║  ██║███████║██║██║ ╚═╝ ██║██╔╝ ██╗
╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚═╝╚═╝     ╚═╝╚═╝  ╚═╝
radarsimpy.simulator.sim_radar(radar, targets, frame_time=0, density=1, level=None, log_path=None, ray_filter=None, debug=False, interf=None)

Simulates the radar’s baseband response for a given scene.

This function generates the radar’s baseband response using the provided radar configuration and target data. It supports both ideal point targets and 3D mesh objects, and allows for varying levels of fidelity in the simulation. Additional options include interference modeling, ray density specification, and logging of simulation data.

Parameters:
  • radar (Radar) – The radar object to be used for the simulation.

  • targets (list) –

    The list of targets in the scene. Targets can be either ideal point targets or 3D mesh objects.

    • 3D Mesh Target: A target represented as a 3D model. Each target is defined as a dictionary with the following keys:

      • model (str): Path to the target model file.

      • origin (numpy.ndarray): Origin position of the target model [x, y, z] in meters. Default: [0, 0, 0].

      • location (numpy.ndarray): Location of the target in meters [x, y, z]. Default: [0, 0, 0].

      • speed (numpy.ndarray): Target velocity in meters per second [vx, vy, vz]. Default: [0, 0, 0].

      • rotation (numpy.ndarray): Target orientation in degrees [yaw, pitch, roll]. Default: [0, 0, 0].

      • rotation_rate (numpy.ndarray): Target’s angular velocity in degrees per second [yaw rate, pitch rate, roll rate]. Default: [0, 0, 0].

      • permittivity (complex): Target’s permittivity. Defaults to a perfect electric conductor (PEC).

      • unit (str): Unit of the target model. Supported values: mm, cm, m. Default: m.

    • Ideal Point Target: A simplified target defined as a point in space. Each target is represented as a dictionary with the following keys:

      • location (numpy.ndarray): Target location in meters [x, y, z].

      • rcs (float): Target’s radar cross-section (RCS) in dBsm.

      • speed (numpy.ndarray): Target velocity in meters per second [vx, vy, vz]. Default: [0, 0, 0].

      • phase (float): Target phase in degrees. Default: 0.

    Note: Target parameters can be time-varying by using Radar.timestamp. For example: location = (1e-3 * np.sin(2 * np.pi * 1 * radar.timestamp), 0, 0)

  • frame_time (float or list) – Radar firing times or frame instances, specified as a float or a list of time values. Default: 0.

  • density (float) – Ray density, defined as the number of rays per wavelength. Default: 1.0.

  • level (str or None) –

    Fidelity level of the simulation. Default: None.

    • None: Perform one ray-tracing simulation for the entire frame.

    • pulse: Perform ray-tracing for each pulse.

    • sample: Perform ray-tracing for each sample.

  • log_path (str or None) – Path to save ray-tracing data. Default: None (does not save data).

  • ray_filter (list or None) – Filters rays based on the number of reflections. Only rays with the number of reflections between ray_filter[0] and ray_filter[1] are included in the calculations. Default: None (no filtering).

  • debug (bool) – Whether to enable debug mode. Default: False.

  • interf (Radar or None) – Interference radar object. Default: None.

Returns:

A dictionary containing the simulated baseband response and related data:

  • baseband (numpy.ndarray): Time-domain baseband data with shape [channels/frames, pulses, samples]. The channel/frame order is as follows (with K frames, M Tx channels and N Rx channels):

    • [0, :, :]: Frame[0] Tx[0] Rx[0]

    • [1, :, :]: Frame[0] Tx[0] Rx[1]

    • [N-1, :, :]: Frame[0] Tx[0] Rx[N-1]

    • [N, :, :]: Frame[0] Tx[1] Rx[0]

    • [MN-1, :, :]: Frame[0] Tx[M-1] Rx[N-1]

    • [MN, :, :]: Frame[1] Tx[0] Rx[0]

    • [KMN-1, :, :]: Frame[K-1] Tx[M-1] Rx[N-1]

  • noise (numpy.ndarray): Time-domain noise data with the same shape and order as baseband.

  • interference (numpy.ndarray): Time-domain interference data (if applicable), with the same shape and order as baseband.

  • timestamp (numpy.ndarray): Timestamp array, directly derived from Radar.timestamp.

Return type:

dict