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: 

LabView algorithm state of charge determination

Hi!

I'm very new to LabView and currently trying to make an algorithm determining state of charge in a battery for one of my classes. Unfortunately I've stumbled upon some obstacles in making the LabView code. For the first time I can't find the solutions anywhere, so you guys are my last resort, hopefully you can help me:(. Here are the things I don't really know how to solve;

1. How to get a percentage value out of voltage measurement where 13.5V equals to 100% and 10.5 equals 0% where there is a linear correlation between these "points". Then depending on what voltage reading I get make it the percentage value.

2. Measuring current multiple times and how to sample these readings and calculate the average value.

3. How to make an equation where I have to integrate the average current over time in the equation.

These points should be connected to get a value of the battery state of charge. All the help I can get is very very welcome!

Message 1 of 8
(2,893 Views)

Hi chyrren,

 

when you are "new to LabVIEW" (as can be seen by the way you spell LabVIEW) you should take note of those "Training resources" offered in the header of this LabVIEW board…

 

1. This is a simple linear interpolation:

percentage := (input - min) / (max - min) * 100

You already gave the min/max values, so this equation is rather easy to implement!

(When you have done this you might also read the help for Threshold1DArray, which does a very similar job.)

 

2. Have you noticed that Example finder coming with LabVIEW? When you use a DAQmx device to read your current data then you should examine some of those DAQmx example VIs…

(To learn the DAQmx basics you should read this.)

 

3. An "integration" mostly boils down to a summation over time when using digitized DAQ readings: all you need is a shift register and an Add function!

(You might also explore the functions listed in the Signal Processing -> PointByPoint palettes…)

 


@chyrren wrote:

These points should be connected to get a value of the battery state of charge.


The items 1-3 will give a rough SoC estimation for a lead battery, there are other SoC formulas in the literature…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 8
(2,870 Views)

Hello!

I am currently working with a project where I am programming an algorithm in LabVIEW to calculate the state of charge of a battery. Where I am planning on measuring the Open Circuit voltage and then converting that value to an initial state of charge value, and then via "Coulomb Counting" calculate the present state of charge by subtracting the integration of the measured current over time, and here is where the main problem comes up. I have tried to find the answer everywhere without any success.

How do I do this integration of the measured current over time?

And any general advice for how to program this algorithm is also very welcome.

0 Kudos
Message 3 of 8
(2,737 Views)

Chyrren,

 

Members of this forum won't do your homework for you!  However, we love to help out if you show us that you're trying.

 

If you write literally any code at all we'd love to help point out what can be improved and where the bug might be, but until you get at least that far, you won't get anything beyond the most general of advice.

 

You also need to provide more information.  You haven't even said how you're going to be measuring voltage or current.  Do you have a NI DAQ of some kind?  Maybe some kind of external test equipment like a multimeter that you can connect to a PC?

0 Kudos
Message 4 of 8
(2,701 Views)

Integration is really nothing more than adding all of your measurements.  The simple method would be to use the Integrate PtByPt VI.  But I would probably go the route of using a shift register to keep the count of Coulombs.  You just take your current reading (Amps), multiply by the number of seconds between your samples (Amps = Coulombs/sec, therefore A*s = # of Coulombs), and then add to the count in the shift register.


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 5 of 8
(2,672 Views)

Thank you for all of your replies! Sorry for my previous vague question and everything.

I have developed the shared code so far, and wondering if the integration technique is correct, aswell as the measuring codes. And how to connect the results from the integration and the formula.

0 Kudos
Message 6 of 8
(2,617 Views)
0 Kudos
Message 7 of 8
(2,615 Views)

Hi chyrren,

 


@chyrren wrote:

Code:


No code in your last message, just an image of (parts of?) a block diagram…

 

Why don't you use AutoCleanup?

What's the point in trying to subtract two control references???

What's the point if the shift register in the loop?

Why are there coercion dots at the integration function?

Which value is connected to the dt input of the integration? What is its purpose?

What about DATAFLOW when trying to subtract "IntegralX" from "SOC t0"?

 

So many questions - and still no code!

Best regards,
GerdW


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