Main Content

流和加速系统模拟

Phased Array System Toolbox™ can be used to model an end-to-end phased array system - generate a transmitted waveform, simulate the target return, and then process the received signal to detect the target. This is shown in the examplesSimulating Test Signals for a Radar Receiver波形设计以提高现有系统的范围性能。此示例显示了如何在流模式下模拟此类系统,因此您可以长时间运行模拟并观察系统动力学。

Simulation Setup

首先,设置具有一些基本参数的雷达系统。整个雷达系统类似于波形设计以提高现有系统的范围性能example.

fs = 6e6; bw = 3e6; c = 3e8; fc = 10e9; prf = 18750; num_pulse_int = 10; [waveform,transmitter,radiator,collector,receiver,sensormotion,。。。目标,tgtmotion,频道,匹配窗,tvg,阈值] =。。。helperRadarStreamExampleSystemSetup(fs,bw,prf,fc,c);

System Simulation

接下来,运行100个脉冲的模拟。在此模拟过程中,使用四个时间范围来观察各个阶段的信号。前三个示波器显示传输信号,接收的信号以及10个脉冲的匹配后过滤器和增益调整的信号。尽管传输信号是高功率脉冲序列,但范围2由于传播损失而显示出较弱的接收信号。无法使用预设检测阈值检测该信号。即使在匹配过滤并获得薪酬之后,检测所有三个目标仍然具有挑战性。

% pre-allocationfast_time_grid = 0:1/fs:1/prf-1/fs;num_pulse_samples = numel(fast_time_grid);rx_pulses =复杂(Zeros(num_pulse_samples,num_pulse_int));mf_pulses =复杂(Zeros(num_pulse_samples,num_pulse_int));detect_pulse = zeros(num_pulse_samples,1);% simulation loop为了m = 1:10*num_pulse_int% Update sensor and target positions[SensorPos,Sensorvel] = sensormotion(1/prf);[tgtpos,tgtvel] = tgtmotion(1/prf);%计算传感器所见的目标角度[tgtrng,tgtang] = rangeangle(tgtpos,sensorpos);%模拟目标方向的脉冲传播pulse = waveform(); [pulse,txstatus] = transmitter(pulse); txsig = radiator(pulse,tgtang); txsig = channel(txsig,sensorpos,tgtpos,sensorvel,tgtvel);%反射脉冲的目标tgtsig = target(txsig);% Receive target returns at sensorrxsig = collector(tgtsig,tgtang);nn = mod(m-1,num_pulse_int)+1;rx_pulses(:,nn)=接收器(rxsig,〜(txstatus> 0));%检测处理mf_pulses(:,nn) = matchedfilter(rx_pulses(:,nn)); mf_pulses(:,nn) = tvg(mf_pulses(:,nn));% Perform pulse integration every 'num_pulse_int' pulsesifnn == num_pulse_int detect_pulse = pulsint(mf_pulses,“非合法者”);结尾helperRadarStreamDisplay(pulse,abs(rx_pulses(:,nn)),。。。abs(mf_pulses(:,nn)),detect_pulse,。。。sqrt(阈值)*一个(num_pulse_samples,1));结尾

使用代码生成提高模拟速度

Because radar systems require intensive processing, simulation speed is a major concern. After you have run 100 pulse to check out your code, you may want to run 1000 pulses. When you run the simulation in interpreted MATLAB® mode, you can measure the elapsed time using:

tic; helperRadarStreamRun; time_interpreted = toc
time_interpreted = 8.0410

如果模拟太慢,则可以使用MATLAB CODER™加快速度。MATLAB编码器可以生成编译的MATLAB代码,从而显着提高处理速度。在此示例中,MATLAB编码器从HelperradarStreamRun函数生成了HelperradarStreamRun_mex函数。

codegenHelperradarstreamrun.m
Code generation successful.

When the mex version is invoked, the simulation speed is improved.

tic; helperRadarStreamRun_mex; time_compiled = toc
time_compiled = 2.0587

Speedup improvement depends on several factors such as machine CPU speed and available memory but is typically increased 3-4 times. Note that the visualization of data using scopes is not sped up by MATLAB Coder and is still handled by the MATLAB interpreter. If visualizations are not critical to your simulation, then you can remove them for further speed improvement.

Below are several trade-offs to consider when adopting this approach:

  1. 与MATLAB中可用的相比,生成代码中的可视化能力非常有限。如果您需要在模拟中保持可视化,请使用coder.extrinsictrick; but this slows down the simulation.

  2. The generated code does not allow dynamic changes of variable type and size compared to the original MATLAB code. The generated code is often optimized for a particular variable type and size; therefore, any change in a variable type and size, which can be caused, for example, by a change in PRF, requires a recompile.

  3. The simulation speed benefit becomes more important when the MATLAB simulation time is long. If MATLAB simulation finishes in a few seconds, you do not gain much by generating the code from the original MATLAB simulation. As mentioned in the previous bullet, it is often necessary to recompile the code when parameters change. Therefore, it might be better to first use MATLAB simulation to identify appropriate parameter values and then use generated code to run long simulations.

概括

此示例显示了如何在流模式下执行雷达系统模拟。它还显示了如何使用代码生成来加快仿真。最后讨论了使用生成的代码和MATLAB代码之间的权衡。