No changes between revisions
/Modules/PowerSupply/LION2CELL01C/SW/guage.csv
0,0 → 1,142
Class,SubclassID,Subclass,Offset,Name,DataType,MinValue,MaxValue,DefaultValue,Units
Configuration,2,Safety,0,OT Chg,I2,0,1200,550,0.1gradC
Configuration,2,Safety,2,OT Chg Time,U1,0,60,2,s
Configuration,2,Safety,3,OT Chg Recovery,I2,0,1200,500,0.1gradC
Configuration,2,Safety,5,OT Dsg,I2,0,1200,600,0.1gradC
Configuration,2,Safety,7,OT Dsg Time,U1,0,60,2,s
Configuration,2,Safety,8,OT Dsg Recovery,I2,0,1200,550,0.1gradC
Configuration,32,Charge Inhibit Cfg,0,Chg Inhibit Temp Low,I2,-400,1200,0,0.1gradC
Configuration,32,Charge Inhibit Cfg,2,Chg Inhibit Temp High,I2,-400,1200,450,0.1gradC
Configuration,32,Charge Inhibit Cfg,4,Temp Hys,I2,0,100,50,0.1gradC
Configuration,34,Charge,0,Suspend Low Temp,I2,-400,1200,-50,0.1gradC
Configuration,34,Charge,2,Suspend High Temp,I2,-400,1200,550,0.1gradC
Configuration,36,Charge Termination,0,Taper Current,I2,0,1000,100,mA
Configuration,36,Charge Termination,2,Min Taper Capacity,I2,0,1000,25,0.01 mAh
Configuration,36,Charge Termination,4,Cell Taper Voltage,I2,0,1000,100,mV
Configuration,36,Charge Termination,6,Current Taper Window,U1,0,60,40,s
Configuration,36,Charge Termination,7,TCA Set %,I1,-1,100,99,%
Configuration,36,Charge Termination,8,TCA Clear %,I1,-1,100,95,%
Configuration,36,Charge Termination,9,FC Set %,I1,-1,100,100,%
Configuration,36,Charge Termination,10,FC Clear %,I1,-1,100,98,%
Configuration,36,Charge Termination,11,DODatEOC Delta T,I2,0,1000,100,0.1gradC
Configuration,48,Data,0,Rem Cap Alarm,I2,0,700,100,mAh
Configuration,48,Data,8,Initial Standby,I1,-256,0,-10,mA
Configuration,48,Data,9,Initial MaxLoad,I2,-32767,0,-500,mA
Configuration,48,Data,13,Manufacture Date,U2,0,65535,0,Date code
Configuration,48,Data,15,Serial Number,H2,0000,ffff,1,num
Configuration,48,Data,17,Cycle Count,U2,0,65535,0,Count
Configuration,48,Data,19,CC Threshold,I2,100,32767,900,mAh
Configuration,48,Data,21,Design Capacity,I2,0,32767,1000,mAh
Configuration,48,Data,23,Design Energy,I2,0,32767,5400,mWh/cWh
Configuration,48,Data,25,SOH Load Current,I2,-32767,0,-400,mA
Configuration,48,Data,27,TDD SOH Percent,I1,0,100,90,%
Configuration,48,Data,28,Cell Charge Voltage T1-T2,U2,0,4600,4200,mV
Configuration,48,Data,30,Cell Charge Voltage T2-T3,U2,0,4600,4200,mV
Configuration,48,Data,32,Cell Charge Voltage T3-T4,U2,0,4600,4100,mV
Configuration,48,Data,34,Charge Current T1-T2,U1,0,100,10,% of des cap
Configuration,48,Data,35,Charge Current T2-T3,U1,0,100,50,% of des cap
Configuration,48,Data,36,Charge Current T3-T4,U1,0,100,30,% of des cap
Configuration,48,Data,37,JEITA T1,I1,-128,127,0,gradC
Configuration,48,Data,38,JEITA T2,I1,-128,127,10,gradC
Configuration,48,Data,39,JEITA T3,I1,-128,127,45,gradC
Configuration,48,Data,40,JEITA T4,I1,-128,127,55,gradC
Configuration,48,Data,41,ISD Current,I2,0,32767,10,HourRate
Configuration,48,Data,43,ISD Current Filter,U1,0,255,127,-
Configuration,48,Data,44,Min ISD Time,U1,0,255,7,Hour
Configuration,48,Data,45,Design Energy Scale,U1,1,10,1,1 or 10 only
Configuration,48,Data,46,Device Name,S9,x,x,bq34z100,-
Configuration,48,Data,55,Manufacturer Name,S12,x,x,Texas Inst.,-
Configuration,48,Data,67,Device Chemistry,S5,x,x,LION,-
Configuration,49,Discharge,0,SOC1 Set Threshold,U2,0,65535,150,mAh
Configuration,49,Discharge,2,SOC1 Clear Threshold,U2,0,65535,175,mAh
Configuration,49,Discharge,4,SOCF Set Threshold,U2,0,65535,75,mAh
Configuration,49,Discharge,6,SOCF Clear Threshold,U2,0,65535,100,mAh
Configuration,49,Discharge,9,Cell BL Set Volt Threshold,I2,0,5000,2800,mV
Configuration,49,Discharge,11,Cell BL Set Volt Time,U1,0,60,2,s
Configuration,49,Discharge,12,Cell BL Clear Volt Threshold,I2,0,5000,2900,mV
Configuration,49,Discharge,14,Cell BH Set Volt Threshold,I2,0,5000,4300,mV
Configuration,49,Discharge,16,Cell BH Set Volt Time,U1,0,60,2,s
Configuration,49,Discharge,17,Cell BH Clear Volt Threshold,I2,0,5000,4200,mV
Configuration,56,Manufacturer Data,0,Pack Lot Code,H2,0,0xFFFF,0000,-
Configuration,56,Manufacturer Data,2,PCB Lot Code,H2,0,0xFFFF,0000,-
Configuration,56,Manufacturer Data,4,Firmware Version,H2,0,0xFFFF,0000,-
Configuration,56,Manufacturer Data,6,Hardware Revision,H2,0,0xFFFF,0,-
Configuration,56,Manufacturer Data,8,Cell Revision,H2,0,0xFFFF,0,-
Configuration,56,Manufacturer Data,10,DF Config Version,H2,0,0xFFFF,0,-
Configuration,57,Integrity Data,6,Static Chem DF Checksum,H2,00x7fff,0x75F2,0,-
Configuration,59,Lifetime Data,0,Lifetime Max Temp,I2,0,1400,300,0.1gradC
Configuration,59,Lifetime Data,2,Lifetime Min Temp,I2,-600,1400,200,0.1gradC
Configuration,59,Lifetime Data,4,Lifetime Max Chg Current,I2,-32767,32767,0,mA
Configuration,59,Lifetime Data,6,Lifetime Max Dsg Current,I2,-32767,32767,0,mA
Configuration,59,Lifetime Data,8,Lifetime Max Pack Voltage,I2,0,32767,3200,mV
Configuration,59,Lifetime Data,10,Lifetime Min Pack Voltage,I2,0,32767,3500,mV
Configuration,60,Lifetime Temp Samples,0,Lifetime Flash Count,U2,0,65535,0,-
Configuration,64,Registers,0,Pack Configuration,H2,0,0xFFFF,0x0161,-
Configuration,64,Registers,2,Pack Configuration B,H1,0,0xFF,0xFF,Flgs
Configuration,64,Registers,3,Pack Configuration C,H1,0,0xFF,0x30,Flgs
Configuration,64,Registers,4,LED_Comm Configuration,H1,0,0xFF,0x00,Flgs
Configuration,64,Registers,5,Alert Configuration,H2,0,0xFFFF,0x0000,Flgs
Configuration,64,Registers,7,Number of Series Cells,U1,1,100,1,-
Configuration,66,Lifetime Resolution,3,LT Update Time,U2,0,65535,60,s
Configuration,67,LED Display,0,LED Hold Time,U1,0,255,4,s
Configuration,68,Power,0,Flash Update OK Voltage Cell Volt,I2,0,4200,2800,mV
Configuration,68,Power,2,Sleep Current,I2,0,100,10,mA
Configuration,68,Power,11,Full Sleep Wait Time,U1,0,255,0,s
System Data,58,Manufacturer Info,0,Manufacturer Info Block 0-31,H1,0,FF,00,-
Gas Gauging,80,IT Cfg,0,Load Select,U1,0,255,1,-
Gas Gauging,80,IT Cfg,1,Load Mode,U1,0,255,0,-
Gas Gauging,80,IT Cfg,21,Max Res Factor,U1,0,255,15,num
Gas Gauging,80,IT Cfg,22,Min Res Factor,U1,0,255,3,num
Gas Gauging,80,IT Cfg,25,Ra Filter,U2,0,1000,500,-
Gas Gauging,80,IT Cfg,42,Fast Qmax Start DOD %,U1,0,255,92,%
Gas Gauging,80,IT Cfg,43,Fast Qmax End DOD %,U1,0,255,96,%
Gas Gauging,80,IT Cfg,44,Fast Qmax Start Volt Delta,I2,0,4200,200,mV
Gas Gauging,80,IT Cfg,67,Cell Termination Voltage,I2,2500,3700,3000,mV
Gas Gauging,80,IT Cfg,69,Cell Termination Voltage Delta,I2,0,4200,50,mV
Gas Gauging,80,IT Cfg,72,Simulation Res Relax Time,U2,0,65534,200,s
Gas Gauging,80,IT Cfg,76,User Rate-mA,I2,-32767,32767,0,mA
Gas Gauging,80,IT Cfg,78,User Rate- mW/cW,I2,-32767,32767,0,mW/cW
Gas Gauging,80,IT Cfg,80,Reserve Cap- mAh,I2,0,9000,0,mAh
Gas Gauging,80,IT Cfg,82,Reserve Energy,I2,0,14000,0,mWh/cWh
Gas Gauging,80,IT Cfg,86,Max Scale Back Grid,U1,0,15,4,-
Gas Gauging,80,IT Cfg,87,Cell Max Delta V,U2,0,65535,200,mV
Gas Gauging,80,IT Cfg,89,Cell Min Delta V,U2,0,65535,0,mV
Gas Gauging,80,IT Cfg,91,Max Sim Rate,U1,0,255,2,C/rate
Gas Gauging,80,IT Cfg,92,Min Sim Rate,U1,0,255,20,C/rate
Gas Gauging,80,IT Cfg,93,Ra Max Delta,U2,0,32767,44,mOHM
Gas Gauging,80,IT Cfg,95,Qmax Max Delta %,U1,0,100,5,mAh
Gas Gauging,80,IT Cfg,96,Cell DeltaV Max Delta,U2,0,65535,10,mV
Gas Gauging,80,IT Cfg,102,Fast Scale Start SOC,U1,0,100,10,%
Gas Gauging,80,IT Cfg,107,Charge Hys Voltage Shift,I2,0,2000,40,mV
Gas Gauging,81,Current Thresholds,0,Dsg Current Threshold,I2,0,2000,60,mA
Gas Gauging,81,Current Thresholds,2,Chg Current Threshold,I2,0,2000,75,mA
Gas Gauging,81,Current Thresholds,4,Quit Current,I2,0,1000,40,mA
Gas Gauging,81,Current Thresholds,6,Dsg Relax Time,U2,0,8191,60,s
Gas Gauging,81,Current Thresholds,8,Chg Relax Time,U1,0,255,60,s
Gas Gauging,81,Current Thresholds,9,Quit Relax Time,U1,0,63,1,s
Gas Gauging,81,Current Thresholds,10,Max IR Correct,U2,0,1000,400,mV
Gas Gauging,82,State,0,Qmax Cell 0,I2,0,32767,1000,mAh
Gas Gauging,82,State,2,Cycle Count,U2,0,65535,0,-
Gas Gauging,82,State,4,Update Status,H1,0x00,0x06,0x00,-
Gas Gauging,82,State,5,Cell V at Chg Term,I2,0,5000,4200,mV
Gas Gauging,82,State,7,Avg I Last Run,I2,-32768,32767,-299,mA
Gas Gauging,82,State,9,Avg P Last Run,I2,-32768,32767,-1131,mW/cW
Gas Gauging,82,State,11,Cell Delta Voltage,I2,-32768,32767,2,mV
Gas Gauging,82,State,15,T Rise,I2,0,32767,0,-
Gas Gauging,82,State,17,T Time Constant,I2,0,32767,32767,-
OCV Table,83,OCV Table,0,Chem ID,H2,0,0xFFFF,0107,-
Calibration,104,Data,0,CC Gain (Note 4),F4,1.00E-01,4.00E+01,0.47095,num
Calibration,104,Data,4,CC Delta (Note 4),F4,2.98E+04,1.19E+06,5.595e5,num
Calibration,104,Data,8,CC Offset (Note 4),I2,-32768,32767,-1200,num
Calibration,104,Data,10,Board Offset (Note 4),I1,-128,127,0,num
Calibration,104,Data,11,Int Temp Offset,I1,-128,127,0,0.1gradC
Calibration,104,Data,12,Ext Temp Offset,I1,-128,127,0,0.1gradC
Calibration,104,Data,13,Pack V Offset,I1,-128,127,0,mV
Calibration,104,Data,14,Voltage Divider,U2,0,65535,5000,mV
Calibration,107,Current,1,Deadband,U1,0,255,5,mA
Security,112,Codes,0,Sealed to Unsealed,H4,0,ffffffff,36720414,-
Security,112,Codes,4,Unsealed to Full,H4,0,ffffffff,ffffffff,-
Security,112,Codes,8,Authen Key3,H4,0,ffffffff,01234567,-
Security,112,Codes,12,Authen Key2,H4,0,ffffffff,89ABCDEF,-
Security,112,Codes,16,Authen Key1,H4,0,ffffffff,FEDCBA98,-
Security,112,Codes,20,Authen Key0,H4,0,ffffffff,76543210,-
/Modules/PowerSupply/LION2CELL01C/SW/guage.py
0,0 → 1,119
#!/usr/bin/python
 
# Python example of use pymlab with LIONCELL MLAB module
 
import time
import sys
from pymlab import config
 
import pandas as pd # data parsing library
import struct
 
filename = './guage.csv'
 
df = pd.read_csv(filename,delimiter=',')
 
def ReadFlash(ID, offset, name, typ, units, default):
flash = guage.ReadFlashBlock(ID, offset // 32)
print ID, '\t', offset, '\t', '"', '{:32s}'.format(name), '"', '\t', typ, '\t',
# if (offset // 32) > 0 :
offset = offset - 32 * (offset // 32)
if typ == 'U1':
print '{:10d}'.format(flash[offset]),
if typ == 'I1':
if flash[offset] > 127:
ble = (256-flash[offset]) * (-1)
else:
ble = flash[offset]
print '{:10d}'.format(ble),
if typ == 'I2':
ble = (flash[offset]<<8)+flash[offset+1]
if ble > 32767:
ble = (65536-ble) * (-1)
print '{:10d}'.format(ble),
if typ == 'U2':
print '{:10d}'.format(abs((flash[offset]<<8)+flash[offset+1])),
if typ == 'F4':
print '{:10s}'.format(hex(0x1000000*flash[offset]+0x10000*flash[(offset+1)]+0x100*flash[(offset+2)]+flash[(offset+3)])),
#print '{:10f}'.format(struct.unpack('@f', chr(flash[offset])+chr(flash[offset+1])+chr(flash[offset+2])+chr(flash[offset+3]))[0]),
if typ == 'H1':
print '{:10s}'.format(hex(flash[(offset)])),
if typ == 'H2':
print '{:10s}'.format(hex(0x100*flash[(offset)]+flash[(offset+1)])),
if typ == 'H4':
print '{:10s}'.format(hex(0x1000000*flash[offset]+0x10000*flash[(offset+1)]+0x100*flash[(offset+2)]+flash[(offset+3)])),
if typ == 'S9':
string = ''
for n in range(9):
string = string + chr(flash[offset+n+1])
print '{:12s}'.format(string+'\0'),
if typ == 'S12':
string = ''
for n in range(9):
string = string + chr(flash[offset+n+1])
print '{:12s}'.format(string+'...\0'),
if typ == 'S5':
string = ''
for n in range(5):
string = string + chr(flash[offset+n+1])
print '{:12s}'.format(string+'\0'),
print '{:10s}'.format('['+units+']'), '\t', default, '{:10s}'.format('['+units+']')
 
 
#### Sensor Configuration ###########################################
cfg = config.Config(
i2c = {
"port": 0, # I2C bus number
},
 
bus = [
{
"type": "i2chub",
"address": 0x73,
"children": [
{"name": "guage", "type": "lioncell", "channel": 7, },
],
},
],
)
 
 
cfg.initialize()
guage = cfg.get_device("guage")
 
#flash = guage.ReadFlashBlock(48, 2)
#print " ".join([hex(i) for i in flash])
 
#print hex(guage.PackConfiguration())
 
#guage.WriteFlashByte(48, 0, 21, 0x0D) # Design Capacity 3350 mAh
#guage.WriteFlashByte(48, 0, 22, 0x16) #
#guage.WriteFlashByte(48, 0, 23, 0x5E) # Design Energy 24120 mWh
#guage.WriteFlashByte(48, 0, 24, 0x38) #
#guage.WriteFlashByte(64, 0, 0, 0x9) # External Voltage Measurement
#guage.WriteFlashByte(64, 0, 7, 0x2) # Two Cells
#guage.WriteFlashByte(64, 0, 4, 0x74) # 8 LED (1+7), Shift Register
#guage.WriteFlashByte(104, 0, 14, 0x28) # Voltage Measurement Range 10240 mV
#guage.WriteFlashByte(104, 0, 15, 0x00) #
#guage.reset() # Reset Guage
 
#flash = guage.ReadFlashBlock(112, 0)
#print "112 - ",
#print " ".join([hex(i) for i in flash])
 
 
#ReadFlash(2, 0, 'OT Chg', 'I2', '0.1 degC')
#ReadFlash(112, 8, 'Authen Key3', 'H4', '-')
 
for i in range(len(df)):
ReadFlash(df['SubclassID'][i], df['Offset'][i], df['Name'][i], df['DataType'][i], df['Units'][i], df['DefaultValue'][i])
 
 
for i in range(4):
# Battery status readout
print "NominalAvailableCapacity =", guage.NominalAvailableCapacity(), "mAh, FullAvailabeCapacity =", guage.FullAvailabeCapacity(), "mAh, AvailableEnergy =", guage.AvailableEnergy(), "* 10 mWh"
print "Temp =", guage.getTemp(), "degC, RemainCapacity =", guage.getRemainingCapacity(), "mAh, cap =", guage.FullChargeCapacity(), "mAh, U =", guage.Voltage(), "mV, I =", guage.AverageCurrent(), "mA, charge =", guage.StateOfCharge(), "%"
time.sleep(3)
 
 
Property changes:
Added: svn:executable
+*
\ No newline at end of property