AOKI's copy&paste archive

高専から駅弁大学から東工大を経て大企業へ 浅く広い趣味とかキャリアの日記を

BEVトラックの燃費・電池容量の推定

purpose

既往文献の真似をしつつトラックの燃費とか必要な諸元を求めようという簡単な計算プログラム
再現性の確認がメインかな

code

# -*- coding: utf-8 -*-
"""
Created on Tue Dec 17 20:03:28 2019

@author: aoki
"""
#%%import
import matplotlib.pyplot as plt
import pandas as pd
#read test data
df = pd.read_excel('WLTP-DHC-12-07e.xls',sheet_name='WLTC_class_3')
#t:c8~,v:e8~,a:f8~(m/s/s)
mile=df.iat[9,10]/1000#m to km
#%%input
g=9.8#m/s/s
coef_arg=0.95
coef_roll=0.01
rho=1.225
eta_e=0.8
eta_c=0.9
#by outsource
#vehicle shape param
weight=20#t
#payload
area=7.1#m2
#coef
sigma=0.15
coef_d=0.6#??
#%%cal
#initialize
i=0
results=[]
weight=weight*1000#t to kg
SoC0=0.8#no dim
battery=(740,3000,4800,6640)#kg
#main
for i in battery:
    print('***** battery weight /kg *****',i)
    #initialize
    capacity=0
    j=0
    #listas
    RL_roll=[]
    RL_air=[]
    RL_accel=[]
    #dataframe to make graph & table
    Rdf=[]
    Rdf0=[]
    Rdfp=[]
    #%%
    for j in range(len(df)-7):#as time
        #vehicle moving param
        v=df.iat[7+j,4]/3.6#km/h to m/s
        accel=df.iat[7+j,5]#m/s/s
        #
        R_roll=coef_roll*(weight+i)*g#necessary?
        R_air=rho/2*coef_d*area*v**2
        if accel>=0:
            R_accel=(1+sigma)*(weight+i)*accel
        else:#Regenerate as negative with speed separete??
            R_accel=(1+sigma)*(weight+i)*accel*0.411
        R=(R_roll+R_air+R_accel)/coef_arg#N
        #%%R lists append as kWh to drow graph
        RL_roll.append(R_roll*v/1000/3600)
        RL_air.append(R_air*v/1000/3600)
        RL_accel.append(R_accel*v/1000/3600)
        #integral
        capacity+=v*R#W=Nm/s to Ws
    capacity=capacity/eta_e/eta_c/1000/3600#Ws to kWh: used energy
    #%%output
    plt.figure()
    fig, ax1=plt.subplots()
    ax1.plot(RL_roll,label='roll')
    ax1.plot(RL_air,label='air')
    ax1.plot(RL_accel,label='accel')
    plt.xlabel('time /sec.')
    plt.ylabel('Resistance work /kWh')
    plt.legend()
    ax2=ax1.twinx()
    ax2.plot(df.iloc[7:len(df),4],label='velocity',linestyle= 'dashed',color='r')
    #plt.legend()
    plt.ylabel('velocity /km/h')
    plt.show()
    #%%R work ratio cal
    #figure
    plt.figure()
    Rdf0=pd.Series({'1':sum(RL_roll),'2':sum(RL_air),'3':sum(RL_accel),'4':0.})
    plt.pie(Rdf0[0:3],labels=['roll','air','accel (including regenerate)'],
            autopct="%1.1f%%")
    title='Resistance work ratio\n'+'when battery weight is '+str(i)+'kg'
    plt.title(title)
    plt.show()
    #table
    Rdf0[3]=sum(Rdf0)
    Rdfp=Rdf0/(Rdf0[3])*100
    Rdf=pd.DataFrame([Rdf0,Rdfp],index=['total resistance work /kWh','ratio /%'])
    Rdf.columns=['roll','air','accel','total']
    pd.options.display.float_format = '{:.2f}'.format
    print(Rdf)
    #%%estimate cf LEAF param
    econ=mile/capacity/SoC0
    est=0.141*i#kWh
    vol=est/0.114/1000
    dist=est/capacity*mile#distance range
    SoC=100-4*80/dist*100#real SoC ratio as est by 4h*80km/h should be positive
    price=est/6.11#only battery cf tesla
    results.append([capacity,econ,dist,est,vol,SoC,price])
#%%
print('*****summary*****')
results=pd.DataFrame(results,index=battery,
                     columns=['cap. /kWh','econ./km/kWh','dist./km',
                              'cap.*/kWh','vol.*/m3','SoC* /%','price/¥10^4'])
#fig by RL
plt.figure()
results.plot(subplots=True)
plt.xlabel('battery weight /kg')
plt.show()
plt.figure()
results.plot(y='econ./km/kWh')
plt.show()
plt.figure()
results.plot(y='SoC* /%')
plt.show()
plt.figure()
results.plot(x='dist./km',y='econ./km/kWh')
plt.show()
#%%
results=results.transpose()
pd.options.display.float_format = '{:.2f}'.format
print(results)
results.to_csv('mileage_output.csv')
〜

result

f:id:pytho:20200118131820p:plainf:id:pytho:20200118131829p:plain