active noise control with simulink real-凯发k8网页登录
design a real-time active noise control system using a speedgoat® simulink® real-time™ target.
active noise control (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 the (simulink real-time) 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: .
anc feedforward model
the following figure illustrates a classic example of feedforward anc. a noise source at the entrance of a duct, such as a fan, is “cancelled” by a loudspeaker. the noise source b(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”.
the primary path is the transfer function between the two microphones, w(z) is the adaptive filter computed from the last available error signal e(n), and the secondary path s(z) is the transfer function between the anc output and the error microphone. the secondary path estimate s'(z) is used to filter the input of the nlms update function. also, the acoustic feedback f(z) from the anc loudspeaker to the reference microphone can be estimated (f'(z)) and removed from the reference signal b(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.
start with a model of a filtered-x nlms anc system, 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.
set the secondary path to s(n) = [0.5 0.5 -.3 -.3 -.2 -.2] and the primary path to conv(s(n), f(n)), where f(n) = [.1 -.1 .2 -.2 .3 -.3 .15 -.15]. verify that the adaptive filter properly converges to f(n), in which case it matches the primary path in our model once convolved with the secondary path. note that s(n) and f(n) were set arbitrarily, but we could try any fir transfer functions, such as an actual impulse response measurement.
secondary path estimation model
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 (see ). 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).
latency measurements
another aspect of performance is the latency of the system, as this determines the minimum distance between the reference microphone and the anc loudspeaker. in our prototype, the active anc loudspeaker that we are using may introduce latency, so we can make sure that this is not an issue by comparing the response between the two microphones to the response between the anc output signal and the error microphone. the difference between these two delays is the maximum time the system has available to compute the anti-noise signal from the reference microphone. using the same nlms identification technique, we obtain the following response from the reference microphone to the error microphone:
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).
references
s. m. kuo and d. r. morgan, in proceedings of the ieee, vol. 87, no. 6, pp. 943-973, june 1999.
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.
(simulink real-time)
see also: