Skip to content

Instantly share code, notes, and snippets.

@rs38
Last active December 27, 2022 22:33
Show Gist options
  • Save rs38/812cce4da5d9937bee7fe522dea9a1b0 to your computer and use it in GitHub Desktop.
Save rs38/812cce4da5d9937bee7fe522dea9a1b0 to your computer and use it in GitHub Desktop.
CoC Fahrwiderstände visualsieren
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import matplotlib.pyplot as plt
#poly: 0.01851,1.6,211
curve = [0.01851,1.6,211] # 2474 kg Turbo
curveRoll = [0.0,1.6,211] # nur Roll
curveLu = [0.01851,0.0,0.0] # nur Luft
curve4S = [0.01737,1.6,192.1] # Prüfmasse 2334kg Taycan 4s kleine Batterie
curveModelY = [0.02658, 1.059,163.04] #2211kg 255er 19"
curvePanaGTS = [0.03036, 1.7, 212.6] # Panamera GTS
x = [x for x in np.linspace(0,250,251)]
r = [np.polyval(curve, i) for i in x]
rroll = [np.polyval(curveRoll, i) for i in x]
rlu = [np.polyval(curveLu, i) for i in x]
r4s = [np.polyval(curve4S, i) for i in x]
rmy = [np.polyval(curveModelY, i) for i in x]
y = [y/36 for y in r]
yr = [y/36 for y in rroll]
y4s = [y/36 for y in r4s]
yl = [y/36 for y in rlu]
ymy = [y/36 for y in rmy]
eta = 0.85 #90%
fix = 0.55 #~ 1 kW ständiger Verbrauch für ECUs etc.
plt.plot(x,y, label="Taycan Turbo 20 ")
y = [(r*(1/eta))+((100/v)*fix) for v,r in zip(x,y)]
plt.grid(True)
#add title
plt.title("Fahrwiderstand/Verbrauch")
#add x and y labels
plt.xlabel("km/h")
#show legend for plot
plt.plot(x,y, 'r--' ,label="Taycan Turbo 20 real ")
plt.plot(x,yr, label="Taycan Rollwiderstand") #"Taycan 4S 19 kl. Akku")
plt.plot(x,yl, label="Taycan Luftwiderstand") #"Taycan 4S 19 kl. Akku")
plt.plot(x,ymy, label="Model Y LR 19") #Panamera GTS 21" )
plt.legend()
plt.ylabel("kWh/100km")
# change plot size
plt.rcParams["figure.figsize"] = (12,12)
# grid granularity
plt.yticks(np.arange(0, 60, 2))
plt.ylim(0,44)
plt.xlim(5,200)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment