From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remove averaging option and take last V&I reading

Solved!
Go to solution

Hello,

I am new to Labview and I need some help with my existing vi code. The current vi is taking 18 samples for voltage and current from UUT. Then it take a subarry of 6 highest value then averaging out. The results is in power consumption between 5.1 w - 6.3w.  Instead of average, I need to record last current and voltage reading and print out the pwr consumption result. I have attached my code. Thanks

0 Kudos
Message 1 of 7
(2,737 Views)

After Looking into your code, Find my suggestions.

1.Use Proper Architecture(Probably state machine will do good for you) instead of Multiple Loops and Sequence Structure.

2.If you want last value of acquired sample (18th Sample)then don't collect data in shift register array  just take the last acquired value from the loop.

3.If you want last value of the sub array of 6 highest Value without averaging then ignore step2 and remove the for loop where addition logic Takes place.

4.Reverse the sub-array and take the first index value which is basically your last element/value.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 7
(2,707 Views)

Hi Palanivel,

Thanks for your suggestion. I would like to do as you mentioned in step # 2. Take 18th sample reading and display. Do I need to rewrite the vi or can I turn off the shift register array?

Thanks,

Milan

0 Kudos
Message 3 of 7
(2,694 Views)

Hope Indexing of Acquired Values in the Loop will give you an array of Vaues, Once all your 18 Samples is read just Reverse the 1D array and Index the First Element.

Ignore the For loop where averaging is done

Just see how this helps you

Sample.png\

Attched only the necessary Snippet use this in youe code

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 7
(2,677 Views)

Added reverse 1D array and index the first element. I am still receiving errors on terminals. See attached. Thanks for your help.

0 Kudos
Message 5 of 7
(2,670 Views)
Solution
Accepted by topic author LV_123!

You are using array subset Instead of index array, so try to use Index array so that error can be eliminated.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
Message 6 of 7
(2,658 Views)

Hello,

Project is working great. Thank you so much for your help and suggestion.

0 Kudos
Message 7 of 7
(2,643 Views)