主要内容

Active Noise Control with Simulink Real-Time

Design a real-time active noise control system using a Speedgoat® Simulink® Real-Time™ target.

主动噪声控制(ANC)

The goal of active noise control is to reduce unwanted sound by producing an “anti-noise” signal that cancels the undesired sound wave. This principle has been applied successfully to a wide variety of applications, such as noise-cancelling headphones, active sound design in car interiors, and noise reduction in ventilation conduits and ventilated enclosures.

In this example, we apply the principles of model-based design. First, we design the ANC without any hardware by using a simple acoustic model in our simulation. Then, we complete our prototype by replacing the simulated acoustic path by theSpeedgoat Target Computers and Speedgoat Support(万博1manbetx实时模拟)and its IO104 analog module. The Speedgoat is an external Real-Time target for Simulink, which allows us to execute our model in real time and observe any data of interest, such as the adaptive filter coefficients, in real time.

This example has a companion video:Active Noise Control – From Modeling to Real-Time Prototyping.

ANC馈电模型

The following figure illustrates a classic example of进料ANC. A noise source at the entrance of a duct, such as a fan, is “cancelled” by a loudspeaker. The noise sourceb(n) is measured with a reference microphone, and the signal present at the output of the system is monitored with an error microphone,e(n). Note that the smaller the distance between the reference microphone and the loudspeaker, the faster the ANC must be able to compute and play back the “anti-noise”.

主要路径是两个麦克风之间的传递函数,W(z)是从最后一个可用错误信号计算出的自适应过滤器e(n)和次要路径S(z) is the transfer function between the ANC output and the error microphone. The secondary path estimateS'(z)用于过滤NLMS更新功能的输入。另外,声学反馈F(z)可以估计从ANC扬声器到参考麦克风(F'(z)) and removed from the reference signalb(n).

To implement a successful ANC system, we must estimate both the primary and the secondary paths. In this example, we estimate the secondary path and the acoustic feedback first and then keep it constant while the ANC system adapts the primary path.

Filtered-X ANC Model

With Simulink and model-based design, you can start with a basic model of the desired system and a simulated environment. Then, you can improve the realism of that model or replace the simulated environment by the real one. You can also iterate by refining your simulated environment when you learn more about the challenges of the real-world system. For example, you could add acoustic feedback or measurement noise to the simulated environment if those are elements that limit the performance of the real-world system.

开始的模型Filtered-X NLMS ANC系统, including both the ANC controller and the duct’s acoustic environment. Assume that we already have an estimate of the secondary path, since we will design a system to measure that later. Simulate the signal at the error microphone as the sum of the noise source filtered by the primary acoustic path and the ANC output filtered by the secondary acoustic path. Use an “LMS Update” block in a configuration that minimizes the signal captured by the error microphone. In a Filtered-X system, the NLMS update’s input is the noise source filtered by the estimate of the secondary path. To avoid an algebraic loop, there is a delay of one sample between the computation of the new filter coefficients and their use by the LMS filter.

将次要路径设置为s(n) = [0.5 0.5 -.3 -.3 -.2 -.2] and the primary path toconv(s(n),f(n)), wheref(n) = [.1 -.1 .2 -.2 .3 -.3 .15 -.15]. Verify that the adaptive filter properly converges tof(n), in which case it matches the primary path in our model once convolved with the secondary path. Note thats(n) andf(n) were set arbitrarily, but we could try any FIR transfer functions, such as an actual impulse response measurement.

次要路径估计模型

Design a model to estimate the secondary path. Use an adaptive filter in a configuration appropriate for the identification of an unknown system. We can then verify that it converges to f(n).

Real-Time Implementation with Speedgoat

To experiment with ANC in a real-time environment, we built the classic duct example. In the following image, from right to left, we have a loudspeaker playing the noise source, the reference microphone, the ANC loudspeaker, and the error microphone.

Latency is critical: the system must record the reference microphone, compute the response and play it back on the ANC loudspeaker in the time it takes for sound to travel between these points. In this example, the distance between the reference microphone and the beginning of the “Y” section is 34 cm. The speed of sound is 343 m/s, thus our maximum latency is 1 ms, or 8 samples at the 8 kHz sampling rate used in this example.

We will be using the Speedgoat real-time target in Simulink, with the IO104 analog I/O interface card. The Speedgoat allows us to achieve a latency as low as one or two samples.

To realize our real-time model, we use the building blocks that we tested earlier, and simply replace the acoustic models by the Speedgoat I/O blocks. We also included the measurement of the acoustic feedback from the ANC loudspeaker to the reference microphone, and we added some logic to automatically measure the secondary path for 10 seconds before switching to the actual ANC mode. During the first 10 seconds, white noise is played back on the ANC loudspeaker and two NLMS filters are enabled, one per microphone. Then, a “noise source” is played back by the model for convenience, but the actual input of the ANC system is the reference microphone (this playback could be replaced by a real noise source, such as a fan at the right end of the duct). The system records the reference microphone, adapts the ANC NLMS filter and computes a signal for the ANC loudspeaker. We take care to set up our model properties so that the IO104 card is driving the cadence of the Simulink model (seeIO104 in interrupt-driven mode). To access the model’s folder, open the example by clicking the “Open Script” button. The model’s file name is “Speedgoat_FXLMS_ANC_model.slx”.

Noise Reduction Performance

We have measured the performance of this ANC prototype with both dual tones and the actual recording of a muffled washing machine. We obtained a noise reduction of 20-30 dB for the dual tones and 8-10 dB for the recording, which is a more realistic but also more difficult case. The convergence rate for the filter is less than a few seconds with tones, but requires much more time for the real case (one or two minutes).

潜伏期测量

性能的另一个方面是系统的延迟,因为这决定了参考麦克风和ANC扬声器之间的最小距离。在我们的原型中,我们正在使用的活动ANC扬声器可能会引入延迟,因此我们可以通过将两个麦克风之间的响应与ANC输出信号与误差麦克风之间的响应进行比较,确保这不是问题。这两个延迟之间的差异是系统可用的最大时间来计算参考麦克风的反噪声信号。使用相同的NLMS识别技术,我们从参考麦克风到误差麦克风的参考麦克风得到以下响应:

Then, we may compare that response to the secondary path estimation:

The difference is only two or three samples, so using our current active loudspeaker and the Speedgoat, we cannot significantly reduce the distance between the reference microphone and the ANC loudspeaker in our prototype. To reduce the distance, we would need a loudspeaker that does not introduce any extra latency. We could also increase the sampling rate of the Simulink model (the Speedgoat latency is set to one or two samples, regardless of the sample rate).

参考

S. M. Kuo和D. R. Morgan,"Active noise control: a tutorial review,"在IEEE论文集,第1卷。87,不。6,第943-973页,1999年6月。

K.-C. Chen, C.-Y. Chang, and S. M. Kuo, "Active noise control in a duct to cancel broadband noise," in IOP Conference Series: Materials Science and Engineering, vol. 237, no. 1, 2017. https://iopscience.iop.org/article/10.1088/1757-899X/237/1/012015.

Speedgoat Target Computers and Speedgoat Support(万博1manbetx实时模拟)

Setting up the IO104 module in Simulink

Setting up the IO104 in interrupt-driven mode

See also:使用过滤的X LMS FIR自适应过滤器进行主动噪声控制