How can i implement OCV for battery capacity in firmware?

What i understood about open circuit voltage method ,when battery is relaxation state then calculate voltage and map these values to SOC look-up table.

But in real time scenario SOC (look-up table) gives me error.so dont want to use look-up table.

is there any other way to implement OCV in firmware ?

i read about ocv here - https://www.richtek.com/Design%20Support/Technical%20Document/AN024

Look-up tables work perfectly well. Unless you think you can derive a formula which accurately maps state-of-charge for your particular battery there is no real option.

If you're getting errors then perhaps they are in the way your code implements the lookup table. But I can't see any code or any errors so I can't help with that.

Steve

i dont have anything but i want to create look-up table measuring voltages in ocv method.

how to derive a formula if you have only voltages values?

But in real time scenario SOC (look-up table) gives me error

Are these compile errors or run errors?

i dont have anything

So are these imaginary errors?

but i want to create look-up table measuring voltages in ocv method

Then create one what is the problem? You need to have the graph for your sort of battery so then you get a list of voltages and what that voltage represents in terms of battery capacity and put that in a lookup table.

how to derive a formula if you have only voltages values?

You still need the table of voltages and what battery capacity that represents like you need for the lookup table, then you need to find a graph which approximates to that table. The simplest form of equation is one of a straight line Y = mX + C, but if the relationship is not a straight line then you need something like this equation from a graph