This example is interactive. Click the play button on any cell to execute it, or run all cells in sequence.

FMCW Radar

In this example we simulate a simple frequency modulated continuous wave (FMCW) radar system.

You can also find this example as a single file in the GitHub repository.

Below we have a very simplistic image of a radar system, it consists of a signal generator, transmitter/reciever chain and directed antennas. The fundamental working principle of a FMCW radar is that if we multiply a chirp signal (linearly frequency modulated sinusoid) with a delayed version of itself, we get a signal that has at each time two frequency components (sum and diffrerence). The low frequency component then is directly proportional to the phase shift between the two signals and this the time delay. This can be used to reconstruct the target distance from the frequency domain spectrum.

radar system

The figure below shows the block diagram of a very basic FMCW radar system consisting of a chirp source (sinusoid with a linearly time dependent frequency), a delay (to model the signal propagation), a multiplier (to model a mixer), a low pass filter and of course blocks for time series and frequency domain data recording.

block diagram of simple fmcw radar system

Lets start by importing the requred classes from PathSim:

Python
Loading...

Now lets define the system parameters starting with the ChirpPhaseNoiseSource, which is defined by the starting frequency, the bandwith and the ramp duration.

Python
Loading...

Next we can build the system by defining the blocks and their connections:

Python
Loading...

Now we are ready to initialize the simulation and run it for some time. Here it makes sense to run it for the duration of one chirp period:

Python
Loading...

Lets have a look at the time series data first. We can do this by calling the plot method of the scope instance. Here we have four traces which we can toggle on and off.

Python
Loading...

It only really gets interesting in the frequency domain. So lets look at the spectrum block (and scale it logarithmically):

Python
Loading...
Python
Loading...

In the spectrum the trace of interest is the output of the low pass filter (purple trace) which is intended to select the signal component that represents the delay, or radar distance. The position of the peak corresponds directly to the target distance, represented by the delay block.

Isolating the spectrum of the lowpass filter and adding the expected target distance (as a frequency) to the plot shows that the FMCW radar system can indeed correctly resolve the range:

Python
Loading...