- refactored luftwiderstand
This commit is contained in:
+28
-56
@@ -9,46 +9,16 @@ g_p0 = 101325
|
|||||||
g_RS = 287.54
|
g_RS = 287.54
|
||||||
|
|
||||||
# CW-Wert und Stirnfläche
|
# CW-Wert und Stirnfläche
|
||||||
c_val_id3 = 0.267
|
|
||||||
area_id3 = 2.360 # m^2
|
|
||||||
|
|
||||||
car_list = [
|
car_list = {
|
||||||
{
|
'VW id.3' : {'cw': 0.267, 'area': 2.36},
|
||||||
"car": "VW id.3",
|
'Tesla Model Y LR AWD': {'cw': 0.23, 'area': 2.518},
|
||||||
"cw": 0.267,
|
'Tesla Model 3 LR AWD': {'cw': 0.23, 'area': 2.220},
|
||||||
"area": 2.360
|
'Polestar 2': {'cw': 0.278, 'area': 2.480},
|
||||||
},
|
'Renault Zoe': {'cw': 0.33, 'area': 2.27},
|
||||||
{
|
'Hyundai Kona Elektro': {'cw': 0.29, 'area': 2.37},
|
||||||
"car": "Tesla Model Y LR AWD",
|
'Hyundai Ioniq': {'cw': 0.24, 'area': 2.22}
|
||||||
"cw": 0.23,
|
}
|
||||||
"area": 2.518
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"car": "Tesla Model 3 LR AWD",
|
|
||||||
"cw": 0.23,
|
|
||||||
"area": 2.220
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"car": "Polestar 2",
|
|
||||||
"cw": 0.278,
|
|
||||||
"area": 2.480
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"car": "Renault Zoe",
|
|
||||||
"cw": 0.33,
|
|
||||||
"area": 2.27
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"car": "Hyundai Kona Elektro",
|
|
||||||
"cw": 0.29,
|
|
||||||
"area": 2.37
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"car": "Hyundai Ioniq Elektro",
|
|
||||||
"cw": 0.24,
|
|
||||||
"area": 2.22
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
temp_list = [-20, -10, 0, 10, 20, 30]
|
temp_list = [-20, -10, 0, 10, 20, 30]
|
||||||
vel_list = [20, 40, 60, 80, 100, 120, 130, 140, 160]
|
vel_list = [20, 40, 60, 80, 100, 120, 130, 140, 160]
|
||||||
@@ -65,32 +35,34 @@ def fd(rho: float, velocity_kmh: float, c_val: float, area: float):
|
|||||||
res = 0.5*rho*vel*vel*cwa
|
res = 0.5*rho*vel*vel*cwa
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def plot_1(fd_reference):
|
def plot_1(car_ref, t_ref=20, v_ref=100):
|
||||||
|
fd_reference_100 = fd(rho(t_ref), v_ref, car_ref['cw'], car_ref['area'])
|
||||||
temps_list_leg = [f"{t}°C" for t in temp_list]
|
temps_list_leg = [f"{t}°C" for t in temp_list]
|
||||||
plot.figure()
|
plot.figure()
|
||||||
for temp_degc in temp_list:
|
for temp_degc in temp_list:
|
||||||
rho_t = rho(temp_degc)
|
rho_t = rho(temp_degc)
|
||||||
y_fd = []
|
y_fd = []
|
||||||
for vel_kmh in vel_list:
|
for vel_kmh in vel_list:
|
||||||
fd_t = (fd(rho_t, vel_kmh, c_val_id3, area_id3)/fd_reference - 1) * 100
|
fd_t = (fd(rho_t, vel_kmh, car_ref['cw'], car_ref['area'])/fd_reference_100 - 1) * 100
|
||||||
y_fd.append(fd_t)
|
y_fd.append(fd_t)
|
||||||
|
|
||||||
plot.plot(vel_list, y_fd)
|
plot.plot(vel_list, y_fd)
|
||||||
|
|
||||||
plot.title("Luftwiderstand vs Geschwindigkeit")
|
plot.title(f"Luftwiderstand vs Geschwindigkeit, T={t_ref}°C, v={v_ref}km/h")
|
||||||
plot.ylabel("Luftwiderstand [%]")
|
plot.ylabel("Luftwiderstand [%]")
|
||||||
plot.xlabel("Geschwindigkeit [km/h]")
|
plot.xlabel("Geschwindigkeit [km/h]")
|
||||||
plot.legend(temps_list_leg)
|
plot.legend(temps_list_leg)
|
||||||
plot.grid()
|
plot.grid()
|
||||||
|
|
||||||
def plot_2(temp=20):
|
def plot_2(car_ref, t_ref=20, v_ref=100):
|
||||||
''' Fd vs. velocity, param: car '''
|
''' Fd vs. velocity, param: car '''
|
||||||
# [kmh]
|
# [kmh]
|
||||||
car_list_leg = [f"{t['car']}" for t in car_list]
|
car_list_leg = [f"{t}" for t in car_list.keys()]
|
||||||
rho_t = rho(temp)
|
rho_t = rho(t_ref)
|
||||||
reference = fd(rho_t, 100, c_val_id3, area_id3)
|
reference = fd(rho_t, v_ref, car_ref['cw'], car_ref['area'])
|
||||||
plot.figure()
|
plot.figure()
|
||||||
for car in car_list:
|
for key in car_list:
|
||||||
|
car = car_list[key]
|
||||||
y_fd = []
|
y_fd = []
|
||||||
for vel_kmh in vel_list:
|
for vel_kmh in vel_list:
|
||||||
fd_t = (fd(rho_t, vel_kmh, car['cw'], car['area'])/reference - 1) * 100
|
fd_t = (fd(rho_t, vel_kmh, car['cw'], car['area'])/reference - 1) * 100
|
||||||
@@ -100,17 +72,17 @@ def plot_2(temp=20):
|
|||||||
|
|
||||||
plot.ylabel("Luftwiderstand ID.3 [%]")
|
plot.ylabel("Luftwiderstand ID.3 [%]")
|
||||||
plot.xlabel("Geschwindigkeit [km/h]")
|
plot.xlabel("Geschwindigkeit [km/h]")
|
||||||
plot.title(f"Luftwiderstand vs Geschwindigkeit, Temperature {temp}°C")
|
plot.title(f"Luftwiderstand vs Geschwindigkeit, T={t_ref}°C, v={v_ref}km/h")
|
||||||
plot.legend(car_list_leg)
|
plot.legend(car_list_leg)
|
||||||
plot.grid()
|
plot.grid()
|
||||||
|
|
||||||
def plot_3(y_fd, y_pwr, temp=20):
|
def plot_3(y_fd, y_pwr, t_ref=20):
|
||||||
car_list_leg = [f"{t['car']}" for t in car_list]
|
car_list_leg = [f"{t}" for t in car_list.keys()]
|
||||||
fig, ax1 = plot.subplots()
|
fig, ax1 = plot.subplots()
|
||||||
ax1.plot(vel_list, y_fd)
|
ax1.plot(vel_list, y_fd)
|
||||||
ax1.set_ylabel("Luftwiderstand [N]")
|
ax1.set_ylabel("Luftwiderstand [N]")
|
||||||
ax1.set_xlabel("Geschwindigkeit [km/h]")
|
ax1.set_xlabel("Geschwindigkeit [km/h]")
|
||||||
ax1.set_title(f"Luftwiderstand vs Geschwindigkeit, Temperature {temp}°C")
|
ax1.set_title(f"Luftwiderstand vs Geschwindigkeit, T={t_ref}°C")
|
||||||
ax1.legend(car_list_leg)
|
ax1.legend(car_list_leg)
|
||||||
ax2 = ax1.twinx()
|
ax2 = ax1.twinx()
|
||||||
ax2.set_ylabel("Antriebsleistung [kW]", color='tab:red')
|
ax2.set_ylabel("Antriebsleistung [kW]", color='tab:red')
|
||||||
@@ -119,7 +91,7 @@ def plot_3(y_fd, y_pwr, temp=20):
|
|||||||
ax1.grid()
|
ax1.grid()
|
||||||
|
|
||||||
def plot_4(y_fd, y_energy, temp=20):
|
def plot_4(y_fd, y_energy, temp=20):
|
||||||
car_list_leg = [f"{t['car']}" for t in car_list]
|
car_list_leg = [f"{t}" for t in car_list.keys()]
|
||||||
fig, ax1 = plot.subplots()
|
fig, ax1 = plot.subplots()
|
||||||
ax1.plot(vel_list, y_fd)
|
ax1.plot(vel_list, y_fd)
|
||||||
ax1.set_ylabel("Luftwiderstand [N]")
|
ax1.set_ylabel("Luftwiderstand [N]")
|
||||||
@@ -134,21 +106,21 @@ def plot_4(y_fd, y_energy, temp=20):
|
|||||||
plot.show()
|
plot.show()
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
|
car = car_list['VW id.3']
|
||||||
# Fd vs. velocity, param: temperature
|
# Fd vs. velocity, param: temperature
|
||||||
reference = fd(rho(20), 100, c_val_id3, area_id3)
|
|
||||||
temp_ref = 20
|
temp_ref = 20
|
||||||
|
|
||||||
# Luftwiderstand [%] vs. Geschwindigkeit [kmh], Param: Temperatur
|
# Luftwiderstand [%] vs. Geschwindigkeit [kmh], Param: Temperatur
|
||||||
plot_1(reference)
|
plot_1(car)
|
||||||
|
|
||||||
# Luftwiderstand [%] vs. Geschwindigkeit [kmh] at 20°C, Param: Car Model
|
# Luftwiderstand [%] vs. Geschwindigkeit [kmh] at 20°C, Param: Car Model
|
||||||
plot_2(temp_ref)
|
plot_2(car, temp_ref)
|
||||||
|
|
||||||
y_fd = []
|
y_fd = []
|
||||||
y_pwr = []
|
y_pwr = []
|
||||||
y_energy = []
|
y_energy = []
|
||||||
for vel_kmh in vel_list:
|
for vel_kmh in vel_list:
|
||||||
fd_t = fd(rho(temp_ref), vel_kmh, c_val_id3, area_id3)
|
fd_t = fd(rho(temp_ref), vel_kmh, car['cw'], car['area'])
|
||||||
y_fd.append(fd_t)
|
y_fd.append(fd_t)
|
||||||
y_pwr.append(fd_t*vel_kmh/1000/3.6)
|
y_pwr.append(fd_t*vel_kmh/1000/3.6)
|
||||||
y_energy.append(fd_t*vel_kmh/1000/3.6*100/vel_kmh)
|
y_energy.append(fd_t*vel_kmh/1000/3.6*100/vel_kmh)
|
||||||
|
|||||||
Reference in New Issue
Block a user