Exemplo n.º 1
0
"""
View plots of the HPPC battery cell data.
"""

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes

from ecm import CellHppcData
from ecm import config_ax

# Data from HPPC battery cell test
# ----------------------------------------------------------------------------

file = '../data/cell-low-current-hppc-25c-2.csv'

data_all = CellHppcData(file, all_data=True)
ids_all = data_all.get_indices_s()

data_hppc = CellHppcData(file)
ids = data_hppc.get_indices_s()
idq = data_hppc.get_indices_q()
idp = data_hppc.get_indices_pulse()
idd = data_hppc.get_indices_discharge()

# Plot all data from HPPC battery cell test
# ----------------------------------------------------------------------------

fig, ax = plt.subplots(tight_layout=True)
ax.plot(data_all.time, data_all.voltage, 'C3', label='data')
ax.plot(data_all.time[ids_all],
        data_all.voltage[ids_all],
Exemplo n.º 2
0
# ----------------------------------------------------------------------------

file_module = '../data/module1-electchar-65ah-23deg.csv'
data_module = ModuleHppcData(file_module)

ecm_module = ModuleEcm(data_module, params)

soc_module = ecm_module.soc()
ocv_module, _, _, vpts_module, zpts_module = ecm_module.ocv(soc_module,
                                                            pts=True)

# ECM for battery cell
# ----------------------------------------------------------------------------

file_cell = '../data/cell-low-current-hppc-25c-2.csv'
data_cell = CellHppcData(file_cell)

# Assume branch current is split evenly for two cells in parallel. Calculate
# cell capacity from module capacity for two cells in parallel. Use OCV and
# SOC points from ECM module to correctly calculate OCV from ECM cell.
ecm_cell = CellEcm(data_cell, params)
ecm_cell.current = data_module.current / 2
ecm_cell.time = data_module.time
ecm_cell.q_cell = params.q_module / 2

soc_cell = ecm_cell.soc()
ocv_cell = ecm_cell.ocv(soc_cell, vz_pts=(vpts_module, zpts_module))

# Print
# ----------------------------------------------------------------------------
Exemplo n.º 3
0
pairs.
"""

import matplotlib.pyplot as plt

import params
from ecm import CellHppcData
from ecm import CellEcm
from ecm import config_ax

# Battery cell HPPC data and equivalent circuit model
# ----------------------------------------------------------------------------

file = '../data/cell-low-current-hppc-25c-2.csv'

data = CellHppcData(file)
ecm = CellEcm(data, params)

# Print curve fit coefficients
# ----------------------------------------------------------------------------

func_otc = ecm.func_otc
func_ttc = ecm.func_ttc

coeffs_otc = ecm.curve_fit_coeff(func_otc, 3)
coeffs_ttc = ecm.curve_fit_coeff(func_ttc, 5)

print('\n--- Curve fit coefficients from OTC ---')
print('a\tb\talpha')
for c in coeffs_otc:
    print(f'{c[0]:.4f}\t{c[1]:.4f}\t{c[2]:.4f}')
Exemplo n.º 4
0
# initial random state of charge (SOC) for each cell, zi units of [-]
zi = np.random.uniform(0.95, 1.00, (n_series, n_parallel))

# initial random capacity (Q) for each cell, qi units of [Ah]
# qi = np.random.uniform(29, 30.7, (n_series, n_parallel))

# total capacity [Ah] of battery pack
# pack capacity is the minimum module capacity
# q_pack = min(np.sum(qi, axis=1))

# Battery cell ECM from battery cell HPPC data
# ----------------------------------------------------------------------------

file_hppc = 'data/cell-low-current-hppc-25c-2.csv'
data_hppc = CellHppcData.process(file_hppc)

ecm = EquivCircModel(data_hppc, params)
soc = ecm.soc()
_, _, _, v_pts, z_pts = ecm.ocv(soc, pts=True)

coeffs = ecm.curve_fit_coeff(ecm.func_ttc, 5)
rctau = ecm.rctau_ttc(coeffs)

# Battery cell discharge data
# ----------------------------------------------------------------------------

file_dis = 'data/cell-discharge-bitrode-1c.csv'
data_dis = CellDischargeData.process_discharge_only(file_dis)

ecm.current = data_dis.current
Exemplo n.º 5
0
# Processed cell discharge data for just the discharge section
# ----------------------------------------------------------------------------

dis_1c = CellDischargeData.process_discharge_only(file_dis_1c)
dis_2c = CellDischargeData.process_discharge_only(file_dis_2c)
dis_3c = CellDischargeData.process_discharge_only(file_dis_3c)

temp_1c = CellTemperatureData.process(file_temp_1c, dis_1c.ti, dis_1c.tf)
temp_2c = CellTemperatureData.process(file_temp_2c, dis_2c.ti, dis_2c.tf)
temp_3c = CellTemperatureData.process(file_temp_3c, dis_3c.ti, dis_3c.tf)

# Electrical model from HPPC cell data
# ----------------------------------------------------------------------------

data = CellHppcData(file_hppc)

ecm = CellEcm(data, params)
soc = ecm.soc()
_, _, _, v_pts, z_pts = ecm.ocv(soc, pts=True)
coeffs = ecm.curve_fit_coeff(ecm.func_ttc, 5)
rctau = ecm.rctau_ttc(coeffs)

# Thermal model from Discharge 1C
# ----------------------------------------------------------------------------

ecm.current = dis_1c.current
ecm.voltage = dis_1c.voltage
ecm.time = dis_1c.time
soc_1c = ecm.soc()
ocv_1c = ecm.ocv(soc_1c, vz_pts=(v_pts, z_pts))
from helpers import get_vt_module_pack
from helpers import r2fit

# Parameters
# ----------------------------------------------------------------------------

n_parallel = 2

# Data
# ----------------------------------------------------------------------------

# data from US06 drive cycle test where 3 modules in series is a pack
data_us06 = PackUs06Data('../data/module123-ir-65ah-us06.csv')

# data from HPPC battery cell test
data_hppc_cell = CellHppcData('../data/cell-low-current-hppc-25c-2.csv')

# data from HPPC battery module test
data_hppc_mod = ModuleHppcData('../data/module1-electchar-65ah-23deg.csv')

# ECM battery cell
# ----------------------------------------------------------------------------

ecm_cell = CellEcm(data_hppc_cell, params)
vt_cell = get_vt_cell_pack(params, n_parallel, data_us06, ecm_cell)

# ECM battery module
# ----------------------------------------------------------------------------

ecm_module = ModuleEcm(data_hppc_mod, params)
vt_module = get_vt_module_pack(data_us06, ecm_module)
Exemplo n.º 7
0
Use HPPC battery cell data to calculate state of charge (SOC) and open circuit
voltage (OCV) for the battery cell.
"""

import matplotlib.pyplot as plt

import params
from ecm import CellHppcData
from ecm import CellEcm
from ecm import config_ax

# Battery cell HPPC data and equivalent circuit model
# ----------------------------------------------------------------------------

file = '../data/cell-low-current-hppc-25c-2.csv'
data = CellHppcData(file)

ecm = CellEcm(data, params)
soc = ecm.soc()
ocv, i_pts, t_pts, v_pts, z_pts = ecm.ocv(soc, pts=True)

# Print
# ----------------------------------------------------------------------------

print(f"{'SOC [-]':10} {'OCV [V]':10}")
for idx, z in enumerate(z_pts):
    print(f'{z:<10.4f} {v_pts[idx]:<10.4f}')

# Plot
# ----------------------------------------------------------------------------
Exemplo n.º 8
0
# Parameters
# ----------------------------------------------------------------------------

n_parallel = 2

# Data
# ----------------------------------------------------------------------------

# data from US06 drive cycle test where 3 modules in series is a pack
file_us06 = '../data/module123-ir-65ah-us06.csv'
data_us06 = PackUs06Data(file_us06)

# data from HPPC battery cell test
file_hppc = '../data/cell-low-current-hppc-25c-2.csv'
data_hppc = CellHppcData(file_hppc)

# ECM battery cell
# ----------------------------------------------------------------------------

ecm = CellEcm(data_hppc, params)
soc = ecm.soc()
_, _, _, v_pts, z_pts = ecm.ocv(soc, pts=True)
coeffs = ecm.curve_fit_coeff(ecm.func_ttc, 5)
rctau = ecm.rctau_ttc(coeffs)

# Cell ECM to pack calculations
# ----------------------------------------------------------------------------

ecm.current = data_us06.current / n_parallel
ecm.time = data_us06.time
Exemplo n.º 9
0
"""
View plots of the battery cell HPPC data.
"""

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes

from ecm import CellHppcData
from utils import config_ax

# Battery cell HPPC data
# ----------------------------------------------------------------------------

file_hppc = 'data/cell-low-current-hppc-25c-2.csv'

data_orig = CellHppcData(file_hppc)
data_proc = CellHppcData.process(file_hppc)

# Plot original battery cell HPPC data
# ----------------------------------------------------------------------------

fig, ax = plt.subplots(tight_layout=True)
ax.plot(data_orig.time, data_orig.current, 'C0')
config_ax(ax, xylabels=('Time [s]', 'Current [A]'))

fig, ax = plt.subplots()
ax.plot(data_orig.time, data_orig.voltage, 'C3')
ax.arrow(15474, 4.06, 0, -0.14, head_width=1000, head_length=0.05, zorder=20)
config_ax(ax, xylabels=('Time [s]', 'Voltage [V]'))
axins = inset_axes(ax, 2, 2, loc='lower left', borderpad=4)
axins.plot(data_orig.time, data_orig.voltage, 'C3')