From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

measure percentage

Hello everyone! I'm doing on our project on labview. We are using a battery and need to measure the percentage of power that the battery left. As the power used, the voltage will also decrease. Here is a table of the relationship between voltage and percentage. Can anyone help me to get the vary value of percentage? Thanks!table.JPG

0 Kudos
Message 1 of 43
(4,581 Views)

Are you having a problem with LabVIEW problem or a problem with math? What have you tried so far?

0 Kudos
Message 2 of 43
(4,572 Views)

Both the problems...How to get the formula of the table? Then how to program on labview?

0 Kudos
Message 3 of 43
(4,564 Views)

So what you mean here is, you want to display the exact percentage of battery depending on the voltage (Suppost 11.23 V mean 54% like that)? You can do a Linear fit (LinearFit.vi) with the Voltage as Y values and Percentage as X values (Or may be the other way) and find the Slope and Intercept. Then with the voltage reading Mulitply the slope and Add the intercept, you are done.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 43
(4,563 Views)

Create an array of points (cluster of xy pairs, x=voltage, y=%), then use interpolate array with the given voltage.

0 Kudos
Message 5 of 43
(4,558 Views)

Actually it is not a linear one...

0 Kudos
Message 6 of 43
(4,527 Views)

Maybe a curve.

0 Kudos
Message 7 of 43
(4,526 Views)

Hi xuan,

 

either use Altenbach's suggestion (with linear interpolation between your data points) or calculate a polynomial regression of your choice. Then use PolynomialEvaluation function to calc battery state from voltage…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 43
(4,515 Views)

Using a lookup table as Altenbach suggested is the easiest way to go.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 43
(4,498 Views)

I'm sorry...Can u give me a more detailed solution?

0 Kudos
Message 10 of 43
(4,466 Views)