Showing results for 
Search instead for 
Did you mean: 
Reply

labview 2010 FPGA: problem with mean-variance subvi

Solved!
Go to Solution
Highlighted

labview 2010 FPGA: problem with mean-variance subvi

The subvi "Mean,Variance and Standard Deviation" seems not to work correctly. The calculation of the mean value is ok but std and variance are wrong and the results change with the representation in a unexpected way. Has anyone experienced such problem? Is there any issue with the use of this function?

 

Thanks

Andrea

0 Kudos
Message 1 of 17 (879 Views)
Reply
0 Kudos

Re: labview 2010 FPGA: problem with mean-variance subvi

Hi Andrea,

 

I can't find any reports of incorrect behavior with that node. Please attach an example showing the incorrect behavior and we can verify if there's a problem.

 

Jim

0 Kudos
Message 2 of 17 (875 Views)
Reply
0 Kudos

Re: labview 2010 FPGA: problem with mean-variance subvi

Dear Jim,

 

thanks for your reply.

In attachment you find a simple example showing this apparent strange behavior.

 

Andrea

0 Kudos
Message 3 of 17 (866 Views)
Reply
0 Kudos

Re: labview 2010 FPGA: problem with mean-variance subvi

Hi Andrea,

 

Thanks for pointing this out. There is indeed an internal overflow problem, which I've reported as a high priority CAR 222056. In the meantime I've converted your node to a subVI and have implemented a fix specific to this particular configuration along with some comments to help explain the changes in case you need to modify it. I'm still testing it and will post something for you on Monday.

 

Sorry for the inconvenience, and thanks again for bringing this to our attention!


Jim

 

0 Kudos
Message 4 of 17 (858 Views)
Reply
0 Kudos

Re: labview 2010 FPGA: problem with mean-variance subvi

Hi Jim,

 

I am looking forward to see and use your fix!Smiley Happy

 

Many thanks

 

Andrea

 

P.S. I suppose there's the same problem for the 2011 Labview version, correct?

0 Kudos
Message 5 of 17 (838 Views)
Reply
0 Kudos

Re: labview 2010 FPGA: problem with mean-variance subvi

Hi Andrea,

 

That's correct, it uses the same code in 2011. FYI, the problem shows up when the variance is relatively small, and a subtraction that is always supposed to give a result greater than or equal to zero produces a negative number due to roundoff error. The fix increases the internal precision to avoid this problem, and will also allow you to customize it for however many bits of output precision you want to keep around for downstream operations.

 

Jim

0 Kudos
Message 6 of 17 (828 Views)
Reply
0 Kudos
Solution
Accepted by topic author skara
‎08-27-2015 06:09 PM

Re: labview 2010 FPGA: problem with mean-variance subvi

Hi Andrea,

 

Here's a new subVI and test for the configuration in your VI (16 samples, I16 input), saved in LabVIEW 2010 SP1. It's fairly straightforward to adapt it to other configurations, but it does involve reconfiguring several nodes and constants on the diagram. Let me know if this will work for you.

 

Regards,

 

Jim

Message 7 of 17 (818 Views)

Re: labview 2010 FPGA: problem with mean-variance subvi

Hi Jim,

 

your solution works fine. Thank you very much.

However I have noted that:

1) this new version uses 3 DSP48 units compared to the 2 DSP48 units of the built-in version (I had to modify my application to fit into the FPGA).

2) The number of samples cannot be easily changed to a value different than a power of two. What is a possible efficient implementation of a division by an integer number? Do you have an example?

 

Andrea

0 Kudos
Message 8 of 17 (795 Views)
Reply
0 Kudos

Re: labview 2010 FPGA: problem with mean-variance subvi

[ Edited ]

JLewis wrote:

Hi Andrea,

 

Here's a new subVI and test for the configuration in your VI (16 samples, I16 input), saved in LabVIEW 2010 SP1. It's fairly straightforward to adapt it to other configurations, but it does involve reconfiguring several nodes and constants on the diagram. Let me know if this will work for you.

 

Regards,

 

Jim


Jim, may I ask why you use double casts to divide by 16 and not a single type cast (see image)?

 

Divide-using-cast.PNG

0 Kudos
Message 9 of 17 (787 Views)
Reply
0 Kudos

Re: labview 2010 FPGA: problem with mean-variance subvi

Jim, may I ask why you use double casts to divide by 16 and not a single type cast (see image)?

 

Divide-using-cast.PNG


Sure. The Type Cast works fine on the desktop but is not supported on FPGA, due to a number of odd behaviors that don't make as much sense in hardware.

 

Jim

Message 10 of 17 (768 Views)