LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog input-output FPGA

Solved!
Go to solution

I ask your help for something else please,
I work on a project in internship, I will realize a CPL emulator.


I start with the signal attenuation and for that I can use a FIR filter or the FFT method.
I have as data the transfers functions  and I also have the impulses responses (complex form), measurements taken on the ground, the reality (201 measures).


For the FIR filter, I tried to calculate the coefficients with functions on MATLAB: (firls and firpm)
I used the FTs (transfers functions) then the impulse responses to determine the coefficients.

 

The second method is FFT, my idea is to move to the frequency domain, multiply by the transfer functions or the impulse response and finally return to the time domain.
I want to know your opinion on the problem, it is feasible or not. ? wich method is better with Labview ?

This is the project if you can take a look. 

Download All
0 Kudos
Message 21 of 31
(1,452 Views)

The short answer is 'yes'. Both methods work and should give you the same results... if correctly implemented.

For finite data set there is 100 % equivalence between time and frequency domain.

 

However there are several issues in your implementation to be corrected.

- When you multiply two FFT's you have to make sure the two complex vectors are of exact same length (I cannot see if it's the case since you didn't provide an example of your signal)

- The two arrays are usually complex and the second half of each array is a mirrored complex conjugate version of the first half. In your case your transfer function is real but it looks like random data (rather than a relatively smooth transfer function). Also the data mirroring is not there. Your transfer function data is not valid.

 

When you perform time domain filtering (convolution) your filter needs to settle first, so the first data samples (corresponding to your FIR length) is not valid. When you do the same operation in the frequency domain you don't see the settling because the the data get wrapped around (circular convolution) so likewise there is a number of invalid data. The difference is fixed by adding samples with zero data (zero padding) to your time domain data before the filtering operations and then take a subset of the result of original length. A little complicated but when correctly done you'll end with the exact same filtered data.

 

I have attached a simplified VI showing how it all works, how the settling is visible. Note that I use the simple convolution function rather than the FIR filtering VI so you can see the settling and un-settling of your single data set filtering.

 

The 'funny' thing here is that the convolution, that is an time domain operation, is actually performed in the frequency domain behind the scene (for perfomance reasons). So this example isn't really proving anything since it compares two methods both calculated in the frequency domain :-).

 

Then there is you FPGA and Host VI. Definitely room for improvement. What you do is exactly what I 'feared'. When you launch your host VI it will immediately start your FPGA streaming. At 100 MS/s you may well have filled up your FIFO before your host VI calls the DMA Read node. You really need to control your timing. Refer to the various shipping examples to get a better understanding of how it works.

 

Good luck with your project!

0 Kudos
Message 22 of 31
(1,446 Views)

Thank you for these explanations.
Honestly it's a little complicated for me and my level Labview.. but I will try to understand each part and correct the code.

0 Kudos
Message 23 of 31
(1,443 Views)

I need some clarification please,
 I want to Attenuate an analogue signal of type (I16). (I have a band of 9khz at 500Khz)

At first I will test all methods in the frequency domain. I will use the Transfers Functions to calculate the filter coeffcients on MATLAB and I will do the convulution with these transfers functions.

i will note use the impulse response now.

In the condition structure,  you use the coefficients for the filter FIR  but also for convolution ? How we make the convolution with the coefficients ?

0 Kudos
Message 24 of 31
(1,435 Views)

Let's first clarify terminology

 

- What to you mean with "I want to Attenuate an analogue signal of type (I16). (I have a band of 9khz at 500Khz)"? Do you mean filter (rather than attenuate)? Are you trying to apply a bandpass filter of 500 kHz +/- 4.5 kHz? If not please clarify!

 

- To filter your signal with a FIR filter, you can either use convolution in the time domain or multiply your spectrum with a (complex) transfer function. You do not convolve with the transfer function.

 

- The FIR filter VI is an extension of the convolution VI. It allows you to filter consecutive data blocks without re-settling your filter every time. In other words the FIR filter will keep the necessary samples around from a data chunk and use these as 'history' when filtering the following chunk rather that assume the 'history' data is zero (which the simple convolution would assume). I used the convolution VI to show the entire result (pre/post settling) since you only wanted to process one data chunk. Use the FIR Filter VI if you plan to filter a signal acquired in Continuous mode.

0 Kudos
Message 25 of 31
(1,432 Views)

I explained it badly because there are several phenomenons that are not very clear.
I only want to attenuate my signal, which I recover from a generator ( a signal acquired in Continuous mode).

So now I will use the FIR filter or the multiplication.

For the FIR, I introduce a temporal signal, and to calculate the coeeficients on MATLAB, I use the TF?

If you can show me an exemple how it works ?

0 Kudos
Message 26 of 31
(1,426 Views)

We start going in circles here...

 

"I only want to attenuate my signal" ; To attenuate a signal you just have to multiply your data with a constant. If you multiply all your samples by 0.1 you'll attenuate your signal 10 times.

 

If your attenuation depends on frequency, it's called filtering. A filter is a system that has a transfer function. The transfer function of a system is the ratio between the response and the stimulus signals (in the frequency domain). If your stimulus (in the time domain) is an ideal impulse, the time domain respons is called the Impulse Response (no kidding) and the transfer function of your system can be reduced to the FFT of that impulse response.

 

In the real world you can't generate an ideal impulse so you can use different types of wideband stimuli instead (band-limited pulse, noise, multitones...). You then have to compute the FFT of both your stimulus and you response signals. I don't know what signals you provided to your Matlab routine, but in LabVIEW you can calculate the transfer function by dividing the Real FFT output of your response by your ditto stimulus. You may also want to check out the LabVIEW System Identification Toolkit

 

If you compute the Inverse FFT of your Transfer Function you get the ideal Impulse Response that you can use as your FIR coefficient in your time domain filtering operation.

 

So again, what is your system? How did you compute the transfer function in Matlab (what signals did you input to the routine and how did you get these signals)? As mentioned earlier your transfer function data is not valid so something went wrong.

 

Most signal processing books explain all this a lot better that I can do in few sentences, so please refer to such books for more information.

 

0 Kudos
Message 27 of 31
(1,422 Views)

Hello LocalDSP 

I return to you to aks abouT the Xilinx FIR Compiler 7.2

I'm trying to filter an analog signal (I16) with the FIR, I made the configuration of the FIR Compiler 7.2 but I do not get anything at the output.
Do you have any idea about the FIR COMPILER 7.2? 

0 Kudos
Message 28 of 31
(1,380 Views)

Sorry I left my crystal ball at home today : Smiley Wink

Seriously, guessing what your issue is based on the (none) information you are giving is a very difficult task.

It could be a configuration issue. I assume you want to run your filter in a single cycle loop. If so have you configured it for that?

Did you get any error when generating the IP?

Are you using the generated IP correctly inside LabVIEW?

 

This is not trivial work, have you read the help for all the parameters and needed steps during the configuration?

If you don't feel safe enough programming LvFPGA and especially using the more advanced tools (like Xilinx IP) you should consider taking a course on the topic(s).

0 Kudos
Message 29 of 31
(1,375 Views)

Yes you're right

The problem is that the examples of NI with FIR Compiler are with version 5.0 but I work with LabVIEW 17 (32bits) and it only accepts the FIR Compiler 7.2
I have this problem only with Xilinx Compiler
I work on windows 7 (64 bits)

I added a folder with the vi

0 Kudos
Message 30 of 31
(1,371 Views)