Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request #4

Open
vx2200 opened this issue Dec 28, 2020 · 3 comments
Open

Feature request #4

vx2200 opened this issue Dec 28, 2020 · 3 comments

Comments

@vx2200
Copy link

vx2200 commented Dec 28, 2020

Hi there, thanks for your great work.
Is it possible to include the SOC (State of Charge) into the code?
Or do i have to calculate it by my own out of the Battery Voltage?

Thank You and a happy new Year!

@jdrescher2006
Copy link

The BMS gives out some more values. You can get them like this:
self.rawdat['Vmain']=int.from_bytes(self.response[0:2], byteorder = 'big',signed=True)/100.0 #total voltage [V] self.rawdat['Imain']=int.from_bytes(self.response[2:4], byteorder = 'big',signed=True)/100.0 #current [A] self.rawdat['RemainCap']=int.from_bytes(self.response[4:6], byteorder = 'big',signed=True)/100.0 #remaining capacity [Ah] self.rawdat['NominalCap']=int.from_bytes(self.response[6:8], byteorder = 'big',signed=True)/100.0 #nominal capacity [Ah] self.rawdat['NumberCycles']=int.from_bytes(self.response[8:10], byteorder = 'big',signed=True) #number of cycles self.rawdat['ProdDate']=int.from_bytes(self.response[10:12], byteorder = 'big',signed=True) #production date self.rawdat['Bal1-16']=int.from_bytes(self.response[12:14],byteorder = 'big',signed=False) #balance state cells 1-16 self.rawdat['Bal17-32']=int.from_bytes(self.response[14:16],byteorder = 'big',signed=False) #balance state cells 17-32 self.rawdat['ProtectState']=int.from_bytes(self.response[16:18],byteorder = 'big',signed=False) #protection state self.rawdat['SoftwareVer']=int.from_bytes(self.response[18:19],byteorder = 'big',signed=False) #software version 0x10 represents version 1.0 self.rawdat['SOC']=int.from_bytes(self.response[19:20],byteorder = 'big',signed=False) #remaining capacity [%] self.rawdat['MosfetState']=int.from_bytes(self.response[20:21],byteorder = 'big',signed=False) #MOS indication State, Bit0 Express charge, bit1 expression discharge, 0=MoS off, 1=open self.rawdat['NumberBat']=int.from_bytes(self.response[21:22],byteorder = 'big',signed=False) #number of cells for i in range(int.from_bytes(self.response[22:23],'big')): #read temperatures self.rawdat['T{0:0=1}'.format(i+1)]=(int.from_bytes(self.response[23+i*2:i*2+25],'big')-2731)/10

@jdrescher2006
Copy link

@vx2200
Copy link
Author

vx2200 commented Feb 26, 2021

The BMS gives out some more values. You can get them like this:
`self.rawdat['Vmain']=int.from_bytes(self.response[0:2], byteorder = 'big',signed=True)/100.0 #total voltage [V]

Thank You! I managed to read and parse all values using the documentation you mentioned already by me own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants