Пример #1
0
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],
        'x',
        label='ids all')
config_ax(ax, xylabels=('Time [s]', 'Voltage [V]'), loc='best')

fig, ax = plt.subplots(tight_layout=True)
ax.plot(data_all.time, data_all.current, 'C0')
config_ax(ax, xylabels=('Time [s]', 'Current [A]'))
Пример #2
0
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}')

print('\n--- Curve fit coefficients from TTC ---')
print('a\tb\tc\talpha\tbeta')
for c in coeffs_ttc:
    print(f'{c[0]:.4f}\t{c[1]:.4f}\t{c[2]:.4f}\t{c[3]:.4f}\t{c[4]:.4f}')
print('')

# Plot curve fit
# ----------------------------------------------------------------------------

# indices representing start (id2) and end (id4) of curve in each SOC section
_, _, id2, _, id4 = data.get_indices_discharge()

for i in range(len(id2)):
    start = id2[i]
    end = id4[i]
    t_curve = data.time[start:end]
    v_curve = data.voltage[start:end]
    t_scale = t_curve - t_curve[0]

    vfit1 = ecm.func_otc(t_scale, *coeffs_otc[i])
    vfit2 = ecm.func_ttc(t_scale, *coeffs_ttc[i])

    fig, ax = plt.subplots(tight_layout=True)
    ax.plot(t_curve, v_curve, 'C3', marker='.', label='data')
    ax.plot(t_curve, vfit1, label='otc')
    ax.plot(t_curve, vfit2, label='ttc')